3v4l.org

run code in 300+ PHP versions simultaneously
<?php include_once("simple_html_dom.php"); //use curl to get html content function getHTML($url,$timeout) { $ch = curl_init($url); // initialize curl with given url curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]); // set useragent curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); // max. seconds to execute curl_setopt($ch, CURLOPT_FAILONERROR, 1); // stop when it encounters an error return @curl_exec($ch); } $html=getHTML("http://www.http://dict.leo.org",10); // Find all images on webpage foreach($html->find("img") as $element) echo $element->src . '<br>'; // Find all links on webpage foreach($html->find("a") as $element) echo $element->href . '<br>'; ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: include_once(): open_basedir restriction in effect. File(simple_html_dom.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/FtaBg on line 2 Warning: include_once(simple_html_dom.php): Failed to open stream: Operation not permitted in /in/FtaBg on line 2 Warning: include_once(): Failed opening 'simple_html_dom.php' for inclusion (include_path='.:') in /in/FtaBg on line 2 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/FtaBg:6 Stack trace: #0 /in/FtaBg(14): getHTML('http://www.http...', 10) #1 {main} thrown in /in/FtaBg on line 6
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:
45.34 ms | 402 KiB | 8 Q