示例#1
0
<?php

exit;
// To test the class from the command line we need a shell with no control
// terminal to avoid SSH from prompting interactively for the password:
// run this with ' ssh -x -T localhost "(cd `pwd` ; php ssh_test.php)" '
// To test on the web, just invoke this script.
$debug_sexec = TRUE;
require_once 'ssh.php';
$remote = "*****@*****.**";
$password = "******";
echo "<pre>\n";
$rmt = new SExec($remote, $password);
if ($rmt == FALSE) {
    echo "Couldn't open the connection\n";
    exit;
}
echo "Created\n";
$debug_copy_to = TRUE;
if (isset($debug_copy_to)) {
    echo "\nCopy ldir ./test.txt to rdir {$remote}:k/.\n";
    $rmt->ssh_copy_to("./test.txt", "k", $out);
}
$rmt->destruct();
echo "</pre>\n\n";
exit;
示例#2
0
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
// To test the class from the command line we need a shell with no control
// terminal to avoid SSH from prompting interactively for the password:
// run this with ' ssh -x -T localhost "(cd `pwd` ; php ssh_test.php)" '
// To test on the web, just invoke this script.
$debug_sexec = TRUE;
require_once 'ssh.php';
#$remote = "*****@*****.**";
#$password = "******";
echo "<pre>\n";
$rmt = new SExec($remote, $password);
if ($rmt == FALSE) {
    echo "Couldn't open the connection\n";
    exit;
}
echo "Created\n";
#$debug_passthru = TRUE;
if (isset($debug_passthru)) {
    echo "Using passthru to send ls...\n\n";
    $rmt->ssh_passthru("ls", $status = 0);
    echo "\nExit status was {$status}";
}
#$debug_exec = TRUE;
if (isset($debug_exec)) {
    $rmt->ssh_exec("ls", $out = "");
    #    $rmt->ssh_exec("ls");