3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_GET['url']='https://www.lostfilm.tv/serials.php'; if(!$_GET['url']) exit; function gethtml($html) { echo 123; $ch = curl_init(); //open curl handle curl_setopt($ch, CURLOPT_URL, $html); //set an url curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //do not output directly, use variable curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); //do a binary transfer curl_setopt($ch, CURLOPT_FAILONERROR, 1); //stop if an error occurred $file=curl_exec($ch); //store the content in variable if(!curl_errno($ch)) { //header ("Content-type: ".curl_getinfo($ch, CURLINFO_CONTENT_TYPE).""); //header ("Content-Length: ".curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD).""); // echo $file; return $file; } else echo 'Curl error: ' . curl_error($ch); curl_close($ch); } $url = $_GET['url']; if(!is_null($_GET['url'])) { $dom = new DOMDocument; @$dom->loadHTML(gethtml($url)); echo json_encode(123); $xpath = new DOMXpath($dom); $links = iterator_to_array($xpath->query('//*[@class="a_discuss"]')); $names = iterator_to_array($xpath->query('//*[@id="new_sd_list"]/span[*]/a/text()')); $array = array(); echo json_encode(123); for($i = 0; $i < count($links) && $i < count($names); ++$i) { $array[0][$i] = mb_convert_encoding($names[$i]->nodue, 'Windows-1251', 'UTF-8'); $array[1][$i] = $links[$i] = str_replace("/discuss.php?cat", "https://www.lostfilm.tv/nrdr2.php?c", $links[$i]->attributes->getNamedItem("href")->nodue); // echo json_encode($array); // echo "<br/>name". $i ."|". mb_convert_encoding($names[$i]->nodue, 'Windows-1251', 'UTF-8'); // echo "<br/>link". $i ."|". $links[$i] = str_replace("/discuss.php?cat", "https://www.lostfilm.tv/nrdr2.php?c", $links[$i]->attributes->getNamedItem("href")->nodue); } echo "var_dump<br />"; echo var_dump($array)."<br /><br />"; echo "print_r<br />"; print_r($array); echo "<br /><br />json_encode<br />"; }
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
123 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/KQSjo:6 Stack trace: #0 /in/KQSjo(24): gethtml('https://www.los...') #1 {main} thrown in /in/KQSjo on line 6
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
123
Process exited with code 255.

preferences:
267.29 ms | 402 KiB | 293 Q