Hi,
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:
<?php
$ip = 'server';
$user = '****';
$pass = '****';
$connection = ssh2_connect($ip, 22);
ssh2_auth_password($connection,$user,$pass);
$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');
stream_set_blocking($stream,1);
stream_set_blocking($stream,true);
while($buffer = fread($stream,1024))
{
echo $buffer;
}
?>
Thank you for any hints or suggestions!
--
roN 2 2628
"roN" <ex*****@example.comwrote:
Hi,
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:
<?php
$ip = 'server';
$user = '****';
$pass = '****';
$connection = ssh2_connect($ip, 22);
ssh2_auth_password($connection,$user,$pass);
$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!***
a second try actually gives following output:
"[i] using plain-text communication "
any ideas are appreciated! Thanks!
//$stream = ssh2_exec($connection,'ls -la');
stream_set_blocking($stream,1);
stream_set_blocking($stream,true);
while($buffer = fread($stream,1024))
{
echo $buffer;
}
?>
"roN" <ex*****@example.comwrote
"roN" <ex*****@example.comwrote:
>Hi,
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:
<?php
$ip = 'server'; $user = '****'; $pass = '****';
$connection = ssh2_connect($ip, 22); ssh2_auth_password($connection,$user,$pass); $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!***
a second try actually gives following output:
"[i] using plain-text communication "
any ideas are appreciated! Thanks!
>//$stream = ssh2_exec($connection,'ls -la'); stream_set_blocking($stream,1); stream_set_blocking($stream,true); while($buffer = fread($stream,1024)) { echo $buffer; } ?>
Would anybody know how to help tho? Would be highly appreciated! Thank you! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: gonchi |
last post by:
Hi,
Something very strangne happens with the function ssh2_exec, i can't
read the stream answer after execution in the remote computer. I work
with apache 1.3.30 and php 4.3.10 , libssh 2.0.5 ....
|
by: brian.vincent |
last post by:
I'm trying to use the ssh2 functions to run a graphical app. I have no
problem opening ssh2_shell and running something like "/bin/ls /tmp".
However when I try to do something like:...
|
by: Wayne |
last post by:
I have a console application (ssh2.exe) that requires keystrokes to be sent
to it after activating.
I have worked that it needs to be started in it own thread, but capturing
the process and...
|
by: Bernhard Günther |
last post by:
Hello friends of php,
PhP-Version is 4 on a FreeBSD-System using apache.
Got a problem using ssh2.sftp.
Installed correctly (libssh2, ssh2.so-module).
Connecting with publickey works,...
|
by: Mark A. Sam |
last post by:
Hello,
I am sending two emails from the same procedure, one to myself (while testing) and another (a comfirmation) to the user on the website.
I was having difficulty finding a relay server to...
|
by: FishGills |
last post by:
For the life of me I can not figure out why I am getting this error:
Error starting up SSH connection(-5): Unable to exchange encryption
keys
$connect = ssh2_connect('d50-1.s50', 22);
...
|
by: nautonnier |
last post by:
Hello,
I have a C# app that spawns several processes each containing a console
app written by another developer in C++. The console app was written
first to be just like a console app: it...
|
by: Varlamov Konstantyn |
last post by:
I have simple script:
<?php
$connection = ssh2_connect("ip", 22);
ssh2_auth_password($connection,"login","test");
|
by: misra |
last post by:
Hi,
I am using a C# code to call blat and send mail.
When I send mails with long sentences, the mail automatically is send with multiple lines.
However, certain times the body and format of the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |