note 105216 deleted from function.ssh2-connect by danbrown

From: Date: Wed, 03 Aug 2011 13:20:53 +0000
Subject: note 105216 deleted from function.ssh2-connect by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182166@lists.php.net to get a copy of this message
Note Submitter: skydiablo at gmx dot net ---- My full implementation of a ssh2 wrapper. easy to use: class find here: https://gist.github.com/1122473 <?php $host = 'php.net'; $username = 'foo'; $password = 'bar'; $publicKeyFile = false; $privateKeyFile = false; $ssh2 = new ssh2($host); if ($ssh2->connect()) { $methods = $ssh2->getAuthMethods($username); $loggedIn = false; switch (true) { case in_array('password', $methods) : $loggedIn = $ssh2->authPassword($username, $password); break; case in_array('publickey', $methods) : $loggedIn = $ssh2->authKey($username, $publicKeyFile, $privateKeyFile); break; } if ($loggedIn) { print_r($ssh2->exec('ls -al')); } $ssh2->disconnect(); } ?>

« previous php.notes (#182166) next »