3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //set up the database connection $servername = "192.129.1.209"; $username = "meaadmin"; $password = "Kasten_15&"; $dbname = "typo3mea"; $dataurl = "http://127.0.0.1:8000/api/thesis?format=json"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //read the json file content $jsondata = file_get_contents($dataurl); //convert json object to php array $data = json_decode($jsondata, true); echo file_get_contents($dataurl); if (empty($data)) { echo "empty"; } $b = count($data); echo $b; //insert into mysql table foreach($data->objects as $obj) { $sql = "INSERT INTO mea_thesis(title) VALUES('".$obj->title."')"; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } } echo "test"; $conn->close(); echo file_get_contents("http://google.com"); //echo phpinfo(); ?>
based on bIf0k
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Class 'mysqli' not found in /in/s2Qal:10 Stack trace: #0 {main} thrown in /in/s2Qal on line 10
Process exited with code 255.
Output for 5.3.17 - 5.6.28
Fatal error: Class 'mysqli' not found in /in/s2Qal on line 10
Process exited with code 255.