הנה דוגמא:
PHP קוד:
<?php
$con=ssh2_connect('192.168.0.1', 22);
ssh2_auth_password($con, "user", "password");
$shell=ssh2_shell($con, 'xterm');
fwrite( $shell, "cd /dir_one\n");
fwrite( $shell, "ls -la\n");
fwrite( $shell, "cd /dir_two\n");
fwrite( $shell, "ls -la\n");
?>
נלקח מהתגובות בעמוד:
http://il2.php.net/manual/en/function.ssh2-shell.php
כמו שאתה רואה יש פה פעולה של התחברות וכמה פעולות של שימוש בתוך ב SSH (כגון ה cd וכו')
פונקציות שימושיות:
ssh2-connect
ssh2-exec
ssh2-shell
ויש את כל המגוון של השימוש ב SSH:
ref.ssh2
בהצלחה :qqb014: