PHP code example of crphp / ssh

1. Go to this page and download the library: Download crphp/ssh 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/ */

    

crphp / ssh example snippets


use Crphp\Ssh\Conector\Ssh;
use Crphp\Ssh\Sistema\MemoriaRam;

$ssh = new Ssh;
$ssh->conectar('endereco_do_servidor', 'usuario', 'senha');

if($ssh->status()) {
    $ram = new MemoriaRam($ssh);
    echo "<pre>";
    print_r($ram->detalhes());
    echo "</pre>";
    
} else {
    echo $ssh->mensagemErro();
}

use Crphp\Ssh\Conector\Ssh;

$ssh = new Ssh;
$ssh->conectar('endereco_do_servidor', 'usuario', 'senha');
echo $ssh->executar('pwd');