3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_url_contents($url){ $crl = curl_init(); $timeout = 5; curl_setopt ($crl, CURLOPT_URL,$url); curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); $ret = curl_exec($crl); curl_close($crl); return $ret; } function post_url_contents($url, $fields) { foreach($fields as $key=>$value) { $fields_string .= $key.'='.urlencode($value).'&'; } rtrim($fields_string, '&'); $crl = curl_init(); $timeout = 5; curl_setopt($crl, CURLOPT_URL,$url); curl_setopt($crl,CURLOPT_POST, count($fields)); curl_setopt($crl,CURLOPT_POSTFIELDS, $fields_string); curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); $ret = curl_exec($crl); curl_close($crl); return $ret; } $streams = json_decode(get_url_contents("https://api.twitch.tv/kraken/streams")); echo "name" . $streams->streams[0]->channel->name;
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/X2CNW:4 Stack trace: #0 /in/X2CNW(33): get_url_contents('https://api.twi...') #1 {main} thrown in /in/X2CNW on line 4
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:
39.84 ms | 401 KiB | 8 Q