<?php
//Скрипт выключения Synology DiskStation
$cfgServer = "localhost"; //адрес сервера, если скрипт лежит на Synology, оставляем localhost
$login = "admin"; //логинимся под админом
$pass = "password"; //пароль
$cfgPort = 23; //порт, telnet - 23, SSH - 22
$cfgTimeOut = 10;
$usenet = fsockopen($cfgServer, $cfgPort, $errno, $errstr, $cfgTimeOut);
if(!$usenet){
echo "Connexion failed<br>";
exit();
}else{
echo "Connected to DiskStation<br>";
stream_set_timeout($usenet, 2);
fputs ($usenet, $login."\r\n");
stream_set_timeout($usenet, 3);
fputs ($usenet, $pass."\r\n");
stream_set_timeout($usenet, 3);
fputs ($usenet, "poweroff\r\n");
stream_set_timeout($usenet, 5);
$j = 0;
while ($j<20){
$res=fgets($usenet, 128);
echo $res;
$j++;
flush();
}
}
fclose($usenet);
echo "End.\r\n";
?>