Hey!
I'm building a simple php app, so that I can control my server through a browser.
This is a short version of the app
Well the problem is that I can't get the response sent from the server. I guess I am using the wrong way of getting it. I've tried a couple of different methods, but I can't get anything.Code:$user = $_POST['user']; //the username, sent with post-method from form. $pass = $_POST['pass']; //the password, sent with post-method from form. $query = $_POST['query']; //the shell command, sent with post-method from form. $ssh = ssh2_connect("localhost"); ssh2_auth_password($ssh, $user, $pass); if($stream = ssh2_exec($ssh, $query)) { $result = ""; while( $buf = fread($stream,4096) ){ $result .= $buf; } fclose($stream); echo $result; }
I know for a fact that the php-ssh2 runs the shell command on the server. But never get any response from the server.. A little frustrating.
Any one?
//Artheus


Reply With Quote

Bookmarks