3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function url_get_contents($url,$ref="http://google.com",$posts=false){ $crl = curl_init(); $timeout = 5; $userAgent = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.71 Chrome/28.0.1500.71 Safari/537.36"; curl_setopt ($crl, CURLOPT_USERAGENT, $userAgent); curl_setopt ($crl, CURLOPT_URL, $url); curl_setopt ($crl, CURLOPT_ENCODING, 'UTF-8'); curl_setopt ($crl, CURLOPT_HEADER, false); curl_setopt ($crl, CURLOPT_REFERER, $ref); curl_setopt ($crl, CURLOPT_RETURNTRANSFER, true); curl_setopt ($crl, CURLOPT_FOLLOWLOCATION, true); curl_setopt ($crl, CURLOPT_AUTOREFERER, true); curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); if($posts){ curl_setopt ($crl, CURLOPT_POST, true); curl_setopt ($crl, CURLOPT_POSTFIELDS, http_build_query($posts)); } $ret = curl_exec($crl); $info = curl_getinfo($crl); if ($ret === false || $info['http_code'] != 200) { $ret = "No cURL data returned for $url [". $info['http_code']. "]"; if (curl_error($crl)) $ret .= "\n". curl_error($crl); } curl_close($crl); return $ret; } echo url_get_contents("http://www.tibia.com"); ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/pBev9:3 Stack trace: #0 /in/pBev9(31): url_get_contents('http://www.tibi...') #1 {main} thrown in /in/pBev9 on line 3
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/pBev9 on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: curl_init() in /in/pBev9 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: curl_init() in /in/pBev9 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: curl_init() in /in/pBev9 on line 3