Skip to main content

Posts

Showing posts with the label Access Remote Server

How to access remote server using PHP SSH?

To remotely access a server in PHP provides a full library of functions called SSH2 functions. You can get the manual from the link . You'll get most of the information from the manual itself but it also leaves the user with some questions which are unanswered. Here i am just trying to explain the same in some better way.. Simple Example :  <?php     if (!function_exists("ssh2_connect"))         die("function ssh2_connect doesn't exist");     if(!($con = ssh2_connect("www.example.com", 22(port number)))){         echo "fail: unable to establish connection\n";     } else {         if(!ssh2_auth_password($con, "username", "password")) {             echo "fail: unable to authenticate\n";         } else {             e...