Jump to content

ssh2 extension


ochi

Recommended Posts

hello, I really can't understand ssh2 extension... It just works "sometimes":

 

$con = ssh2_connect("xx.xx.xx.xx", 22) or die ("Error, address + port");
$autent = ssh2_auth_password($con, 'user', 'password') or die ("Error, user + password");
$stream = ssh2_exec($con, 'ps -ax') or die("executing");
stream_set_blocking($stream, true);     
$output = stream_get_contents($stream,-1);
echo $output; 
fclose($stream); 

 

But $output is empty.

 

The most weird is that if I write:

 

$stream = ssh2_exec($con, 'mplayer rtsp://localhost/sample.mp4') or die("executing");

 

It works!

 

Thank you for your help!

 

Link to comment
https://forums.phpfreaks.com/topic/195009-ssh2-extension/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.