Aller au contenu

Enregistrement Surveillance Station Via Http

Featured Replies

Posté(e)

Bonjour,

Je recherche partout un moyen d'activer et désactiver les enregistrements (via requête http) de ma cam branchée sur surveillance station.

J'ai trouvé des scripts que j'enregistre sur mon nas dans le dossier web mais ça ne marche pas ...

----------------------------------------------

<?php
/*
This script is an example of using curl in php to log into on one page and
then get another page passing all cookies from the first page along with you.
*/
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/SS-session_cookie");
curl_setopt($ch, CURLOPT_URL,"ip:5000/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=1&account=usert&passwd=pass&session=SurveillanceStation");
curl_exec ($ch);
curl_close ($ch);
unset($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/SS-session_cookie");
curl_setopt($ch, CURLOPT_URL,"ip:5000/webapi/SurveillanceStation/extrecord.cgi?api=SYNO.SurveillanceStation.ExternalRecording&method=Record&version=1&cameraId=1&action=start");
curl_exec ($ch);
curl_close ($ch);
unset($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/SS-session_cookie");
curl_setopt($ch, CURLOPT_URL,"ip:5000/webapi/auth.cgi?api=SYNO.API.Auth&method=Logout&version=1&session=SurveillanceStation");
curl_exec ($ch);
curl_close ($ch);
unset($ch);
?>
Si je lance ce script (ip/rec_on.php) j'ai le message suivant :
{"success":true}
----------------------------------------------
<?php
//authentification
//echo $response;
$resArr = array();
$resArr = ($response);
$resArr = json_decode($response,true);
//sid in the array
$sid=array();
$sid=$resArr[data];
//echo $sid[sid];
//send Start record
echo $response;
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;
return $header ['content'];
}
?>
Si je lance ce script (ip/rec_on.php) j'ai le message suivant :
{"error":{"code":400},"success":false}
----------------------------------------------
Mais rien ne se passe... surveillance station ne bouge pas.
Je ne change que l'ip, user et pass...
Merci de votre aide.

Rejoindre la conversation

Vous pouvez publier maintenant et vous inscrire plus tard. Si vous avez un compte, connectez-vous maintenant pour publier avec votre compte.

Invité
Répondre à ce sujet…

Qui est en ligne (Afficher la liste complète)

  • Il n’y a aucun utilisateur enregistré actuellement en ligne

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.