PHP code example of yaroslam / ssh2

1. Go to this page and download the library: Download yaroslam/ssh2 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yaroslam / ssh2 example snippets


$connector = new UserPasswordConnection();
$connector->connect(ssh2_connect($_ENV['host'], 22), ['user' => $_ENV['host'], 'password' =>$_ENV['host']])

$session->exec("ls -la")->apply();
$chainSession->initChain()->exec('ls -la')->apply();

   $session->exec('ls -la');