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) { $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 git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/qslh7:5 Stack trace: #0 /in/qslh7(23): gethtml('https://www.los...') #1 {main} thrown in /in/qslh7 on line 5
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
76.83 ms | 401 KiB | 8 Q