get output from ssh2_shell
Hi,
I try to use SSH2 in PHP to connect to a linux server. Here is the
code:
<pre>
$connection = ssh2_connect('xxx', 22);
if( !$connection ) die("Failed to connect");
if( ! ssh2_auth_password($connection, 'aaa', 'bbb') )
die("FAIL");
$s = ssh2_shell($connection, "vt100");
if( !$s ) die("Can not attach stdio.");
fwrite($s, "ls /tmp");
$o = fread($s, 100);
echo $o;
</pre>
But I can't get any output using fread. How can I get the
output(STDOUT)?
Any help is appreciated! Thanks in advance.
Have a nice day!
Regards
KEN
.
Relevant Pages
- sftp
... I have a script that has to make a connection via sftp and read the contents ... Yet php throws the error that it can't find the ssh2.sftp wrapper. ... if ssh2 installed properly is this fopen syntax correct? ... (php.general) - Re: Have you heard about a MySQL connection leak?
... Jerry Stuckle wrote: ... PHP ... Anyway, the reason a TCP socket connection stays open, is because neither end has closed it. ... (comp.lang.php) - Re: Have you heard about a MySQL connection leak?
... PHP ... Anyway, the reason a TCP socket connection stays open, is because neither end has closed it. ... When an endpoint wishes to stop its half of the connection, it transmits a FIN packet, which the other end acknowledges with an ACK. ... (comp.lang.php) - Re: Have you heard about a MySQL connection leak?
... This doesn't change with scripting languages like PHP. ... Anyway, the reason a TCP socket connection stays open, is because neither end has closed it. ... Normally a PHP script closes all open connections when it exits. ... When an endpoint wishes to stop its half of the connection, it transmits a FIN packet, which the other end acknowledges with an ACK. ... (comp.lang.php) - Re: Have you heard about a MySQL connection leak?
... PHP ... Anyway, the reason a TCP socket connection stays open, is because neither end has closed it. ... Normally a PHP script closes all open connections when it exits. ... When an endpoint wishes to stop its half of the connection, it transmits a FIN packet, which the other end acknowledges with an ACK. ... (comp.lang.php) |
|