PHP執行SSH連線

$connection=ssh2_connect('localhost');

if(!$connection) die('Connection failed');

if(!ssh2_auth_password($connection,'username','password')) die('Login failed');

$stream=ssh2_exec($connection,'ls /tmp');
stream_set_blocking($stream,true);
echo stream_get_contents($stream);
發佈日期:
分類: PHP

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *