Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- sending ssh2 command
February 8, 2007, 9:50 pm
rate this thread
I would like to send an ssh command to our ssh server from which i would
liek to read the output.
I get stuck with following lines:
$ip = 'server';
$user = '****';
$pass = '****';
$connection = ssh2_connect($ip, 22);
$shell = ssh2_shell($connection,"bash");
$cmd = "rrs -l -p42011";
$stream = ssh2_exec($connection, 'rrs -l -p42011');
*** Above line shows what i actually want to get the output from but it just
seems to run, run, and run till it finally times out (but works nicely if
entered in the console manually)... but the next line (which is marked as
comment) gives me a valid output after seconds. I'm totally stuck here, if
anyone could help me, that would be great!***
//$stream = ssh2_exec($connection,'ls -la');
while($buffer = fread($stream,1024))
Thank you for any hints or suggestions!