Code : Tout sélectionner
<?php
// #########################################
// Remplir les informations de connexion ici
// #########################################
$server = "";
$login = "";
$pass = "";
// Paramètres du script
$enable = $argv[1];
/* API VERSIONS */
//SYNO.API.Auth
$vAuth = 3;
// Authentification
$json = file_get_contents($server.'/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version='.$vAuth.'&account='.$login.'&passwd='.$pass.'&format=sid');
$obj = json_decode($json);
if($obj->success != "true"){
echo "Error : ".$json;
exit();
}else{
//authentification successful
$sid = $obj->data->sid;
//Activate/deactivate Wifi
$json = file_get_contents($server.'/webapi/entry.cgi?netif=%22smartconnect%22&config=%7B%22enabled%22%3A'.$enable.'%2C%22guest_enabled%22%3Afalse%7D&api=SYNO.Core.Network.Wifi.Hotspot&method=set&version=2&_sid="'.$sid.'"');
$obj = json_decode($json);
if($obj->success != "true") {
echo "Error 1st call : ".$json;
}
//logout
$json_logout = file_get_contents($server.'/webapi
}
?>
En espérant que cela puisse servir à quelqu'un...
Update du 11/03/19 : mise à niveau vers SRM 1.2 et amélioration de la stabilité
Update du 02/05/2019 : explications sur l'utilisation du script