3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $url="http://www.mobiflip.de/xperia-play-china-geraete-konzept/"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_TIMEOUT, 3); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); // FeedBurner requires a proper USER-AGENT... curl_setopt($curl, CURL_HTTP_VERSION_1_1, true); curl_setopt($curl, CURLOPT_ENCODING, "gzip, deflate"); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3"); $content = curl_exec($curl); $content = substr($content,strpos($content,"<body>")); // $content = substr($content,strpos($content,$n->title)); //echo $content; preg_match_all('@src=[\'"](?:http(?:s)*:)*(?://)*(?P<src>[a-zA-Z0-9/_\-\.]+(jpg|png|gif|jpeg|tif))[\'"\?%]@i', $content, $image); //$c = new DOMDocument(); //@$c->loadXML($content); //var_dump($c->getElementsByTagName('img'));//->item(0)->getAttribute('src'); //$xml=simplexml_load_string($content); //print_r($xml); //return; $actPic = new stdClass(); $actPic->size=0; $actPic->url=null; foreach($image['src'] as $pic){ try{ $pic="http://".$pic; $sz=getimagesize($pic); echo "<br>".$pic.":";var_dump($sz);echo "<br>"; if( $sz && $sz[0]>400 && $sz[0]*$sz[1] > $actPic->size ){ $actPic->size=$sz[0]*$sz[1]; $actPic->url=$pic; } }catch(Exception $e){ Debugbar::addError($e); } } echo "<img src='".$actPic->url."'><br>"; ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/KJafT:6 Stack trace: #0 {main} thrown in /in/KJafT on line 6
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/KJafT on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/KJafT on line 42
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '{' in /in/KJafT on line 42
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/KJafT on line 42
Process exited with code 255.