@ 2016-06-21T09:53:44Z <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>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for git.master , git.master_jit , rfc.property-hooks <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 . 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:dark mode live preview
56.59 ms | 401 KiB | 8 Q