3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<pre> <?php $user = "<username>"; $password = "<password>"; $cameraid = "<camera id>"; //authentification $response = get_web_page("http://diskstation:5000/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=2&account=". $user."&passwd=".$password."&session=SurveillanceStation&format=sid"); //echo $response; $resArr = array(); $resArr = ($response); $resArr = json_decode($response,true); //sid in the array $sid=array(); $sid=$resArr[data]; //echo $sid[sid]; //Request API info: //http://diskstation:5000/webapi/query.cgi?api=SYNO.API.Info&method=Query&version=1&query=SYNO.SurveillanceStation.ExternalRecording //List camera's to find camera ID: //http://diskstation:5000/webapi/_______________________________________________________entry.cgi?api=SYNO.SurveillanceStation.Camera&method=List&version=1&offset=1&limit=30&sid=<sid> //look for: "id": //send Start record $url="http://diskstation:5000/webapi/_______________________________________________________entry.cgi?api=SYNO.SurveillanceStation.ExternalRecording&method=Record&version=2&cameraId=". $cameraid. "&_sid=".$sid[sid]."&action="; //echo 'url: '.$url.'<br />'; $response = get_web_page($url.'start'); sleep(10); $response = get_web_page($url.'stop'); function get_web_page($url) { $options = array (CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle compressed CURLOPT_USERAGENT => "test", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10 ); // stop after 10 redirects $ch = curl_init ( $url ); curl_setopt_array ( $ch, $options ); $content = curl_exec ( $ch ); $err = curl_errno ( $ch ); $errmsg = curl_error ( $ch ); $header = curl_getinfo ( $ch ); $httpCode = curl_getinfo ( $ch, CURLINFO_HTTP_CODE ); curl_close ( $ch ); $header ['errno'] = $err; $header ['errmsg'] = $errmsg; $header ['content'] = $content; echo 'response:<br />'.$content.'<br />'; return $header ['content']; } ?> </pre>

Abusive script

This script was stopped while abusing our resources

Output for 7.0.0 - 7.0.7
<pre> Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /in/vr0rk on line 28 Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /in/vr0rk on line 29 Notice: Use of undefined constant CURLOPT_FOLLOWLOCATION - assumed 'CURLOPT_FOLLOWLOCATION' in /in/vr0rk on line 30 Notice: Use of undefined constant CURLOPT_ENCODING - assumed 'CURLOPT_ENCODING' in /in/vr0rk on line 31 Notice: Use of undefined constant CURLOPT_USERAGENT - assumed 'CURLOPT_USERAGENT' in /in/vr0rk on line 32 Notice: Use of undefined constant CURLOPT_AUTOREFERER - assumed 'CURLOPT_AUTOREFERER' in /in/vr0rk on line 33 Notice: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in /in/vr0rk on line 34 Notice: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /in/vr0rk on line 35 Notice: Use of undefined constant CURLOPT_MAXREDIRS - assumed 'CURLOPT_MAXREDIRS' in /in/vr0rk on line 36 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/vr0rk:37 Stack trace: #0 /in/vr0rk(7): get_web_page('http://diskstat...') #1 {main} thrown in /in/vr0rk on line 37
Process exited with code 255.
Output for 5.5.0 - 5.6.22
<pre> Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /in/vr0rk on line 28 Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /in/vr0rk on line 29 Notice: Use of undefined constant CURLOPT_FOLLOWLOCATION - assumed 'CURLOPT_FOLLOWLOCATION' in /in/vr0rk on line 30 Notice: Use of undefined constant CURLOPT_ENCODING - assumed 'CURLOPT_ENCODING' in /in/vr0rk on line 31 Notice: Use of undefined constant CURLOPT_USERAGENT - assumed 'CURLOPT_USERAGENT' in /in/vr0rk on line 32 Notice: Use of undefined constant CURLOPT_AUTOREFERER - assumed 'CURLOPT_AUTOREFERER' in /in/vr0rk on line 33 Notice: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in /in/vr0rk on line 34 Notice: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /in/vr0rk on line 35 Notice: Use of undefined constant CURLOPT_MAXREDIRS - assumed 'CURLOPT_MAXREDIRS' in /in/vr0rk on line 36 Fatal error: Call to undefined function curl_init() in /in/vr0rk on line 37
Process exited with code 255.