i'm make ssh conneting to my server using "ssh2_connect" function. now i need to execute command and get the return result and echo in the result in the php. "ssh2_connect" is working perfect but i don't know how to execute and get results from the command using this connection. please can you help me to do this. here is my code part for the ssh connectin. <?php $connection = ssh2_connect('www.example.com', 22); if (ssh2_auth_password($connection, 'root', 'samplepassword')) { echo "Authentication Successful!\n"; } else { die('Authentication Failed...'); } ?> Code (markup): thank you !
i try using ss2_exec function ... but it not give me the return result ... can anyone please explain me how to do it ...
You would have to get the stream: http://www.php.net/manual/en/function.ssh2-fetch-stream.php Then get the stream content (look at the comments for examples).