[PHP] Re: PHP SSH2

2006-01-23 Thread Vedanta Barooah
On 1/23/06, Vedanta Barooah [EMAIL PROTECTED] wrote:

 hello all,
 this is in regard to PECL ssh2 ( http://pecl.php.net/package/ssh2 ) : how
 to i print the output of the command executed using ssh2_exec?
 thanks,
 vedanta




--
*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
Vedanta Barooah
YM! - vedanta2006
Skype - vedanta2006


Re: [PHP] Re: PHP SSH2

2006-01-23 Thread David Grant
Vedanta,

I recommend contacting the author of the package, or posting to pecl-dev.

David

Vedanta Barooah wrote:
 On 1/23/06, Vedanta Barooah [EMAIL PROTECTED] wrote:
 hello all,
 this is in regard to PECL ssh2 ( http://pecl.php.net/package/ssh2 ) : how
 to i print the output of the command executed using ssh2_exec?
 thanks,
 vedanta

 
 
 
 --
 *~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
 Vedanta Barooah
 YM! - vedanta2006
 Skype - vedanta2006
 


-- 
David Grant
http://www.grant.org.uk/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP :: SSH2 ??

2005-01-01 Thread M. Sokolewicz
Pari Purna Chand Nannapaneni wrote:
Can anybody give me a small example on using 
ssh2 functions ( http://pecl.php.net/package/ssh2 ).

I want to execute a command on the remote machine and 
want to get the ouput into a phpvariable.

Here is my php code ... 
?php
$connection = ssh2_connect('127.0.0.1', 22);
ssh2_auth_password($connection, 'root', 'myrootpassword');
$stream = ssh2_exec($connection, 'uptime');
echo $stream;
?

I'm getting some Resource id #5 as output.
What does this mean. How to get the actual output of my remote command.
I'm using PHP-4.3.10
best regards,
/Chandu
that is because it returns a stream (as is explained in the manual 
(CVS). However, the docs haven't been updated online yet, so that's why 
you can't find em...). To read from the stream, I *guess* you could use 
any normal stream-reading function. eg. fread() or fget().

trying to echo  a resource, will yield just that... 'Resource Id #n'.
$connection = ssh2_connect('127.0.0.1', 22);
ssh2_auth_password($connection, 'root', 'myrootpassword');
$stream = ssh2_exec($connection, 'uptime');
while(!feof($stream)) {
   $var .= fread($stream, 1024);
}
then you should have all in the $var.
hope that helps,
- Tul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php