3v4l.org

run code in 300+ PHP versions simultaneously
<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>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
<pre> Fatal error: Uncaught Error: Undefined constant "CURLOPT_RETURNTRANSFER" in /in/vr0rk:28 Stack trace: #0 /in/vr0rk(7): get_web_page('http://diskstat...') #1 {main} thrown in /in/vr0rk on line 28
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 <pre> Fatal error: Uncaught Error: Undefined constant "CURLOPT_RETURNTRANSFER" in /in/vr0rk:28 Stack trace: #0 /in/vr0rk(7): get_web_page('http://diskstat...') #1 {main} thrown in /in/vr0rk on line 28
Process exited with code 255.
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.3 - 7.4.33
<pre> Warning: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' (this will throw an Error in a future version of PHP) in /in/vr0rk on line 28 Warning: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' (this will throw an Error in a future version of PHP) in /in/vr0rk on line 29 Warning: Use of undefined constant CURLOPT_FOLLOWLOCATION - assumed 'CURLOPT_FOLLOWLOCATION' (this will throw an Error in a future version of PHP) in /in/vr0rk on line 30 Warning: Use of undefined constant CURLOPT_ENCODING - assumed 'CURLOPT_ENCODING' (this will throw an Error in a future version of PHP) in /in/vr0rk on line 31 Warning: Use of undefined constant CURLOPT_USERAGENT - assumed 'CURLOPT_USERAGENT' (this will throw an Error in a future version of PHP) in /in/vr0rk on line 32 Warning: Use of undefined constant CURLOPT_AUTOREFERER - assumed 'CURLOPT_AUTOREFERER' (this will throw an Error in a future version of PHP) in /in/vr0rk on line 33 Warning: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' (this will throw an Error in a future version of PHP) in /in/vr0rk on line 34 Warning: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' (this will throw an Error in a future version of PHP) in /in/vr0rk on line 35 Warning: Use of undefined constant CURLOPT_MAXREDIRS - assumed 'CURLOPT_MAXREDIRS' (this will throw an Error in a future version of PHP) 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 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.5.36, 5.6.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.

preferences:
215.53 ms | 403 KiB | 206 Q