3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getHTML($http://www.dict.leo.org,$timeout) { $ch = curl_init($http://www.http://dict.leo.org); // 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 5.3.0 - 5.3.28, 5.4.0 - 5.4.29
Parse error: syntax error, unexpected ':', expecting ')' in /in/Y2J1i on line 3
Process exited with code 255.

preferences:
186.74 ms | 1395 KiB | 66 Q