Стоит вопрос автоматизации для SMG-2016 через PHP
Пробовал такую конструкцию:
Код: Выделить всё
<?php
class ssh {
   var $stream;
   var $connection;
   var $data;
   function connect($host,$login,$pass,$port) {
     $this->connection = ssh2_connect($host, $port);
     return ssh2_auth_password($this->connection, $login, $pass);
   }
   function cmd ($cmd) {
     if( !($this->stream=ssh2_exec($this->connection,$cmd )) ) {
       echo "fail: unable to execute command";
     }
     else {
       stream_set_blocking($this->stream, true );
       $this->data = "";
       while( $buf = fread($this->stream,4096) ) {
         $this->data .= $buf;
       }
     }
     return $this->data;
   }
   function close () {
     fclose($this->stream);
   }
};
$S = new ssh();
$S->connect('192.168.0.50', 'admin', 'webastpass125','10122');
echo $S->cmd("space hint no\r");
echo $S->cmd("show system info\r");
$S->close();
?>
Зависает и не возвращает ответа. На LInux сервере все отрабатывает.
Вчем отличие шела Linux от SMG