How do command with action url ?
http://some-hosting.com/ssh2.php?command=reboot
PHP Code:
<?php
// Change please adjust the following variables:
$server['ip'] = "127.0.0.1"; // Host
$server['sshport'] = 22; // SSH Port (Standard: 22)
$server['user'] = "root"; // Username
$server['pw'] = "password"; // Password
$command = "call url"; // This command is executed on the SSH server!
// Change customer from here if possible, nothing more
if($ssh = ssh2_connect($server['ip'], $server['sshport'] )) {
if(ssh2_auth_password($ssh, $server['user'], $server['pw'])) {
$stream = ssh2_exec($ssh, $command);
stream_set_blocking($stream, true);
$data = '';
while($buffer = fread($stream, 4096)) {
$data .= $buffer;
}
fclose($stream);
print $data;
}else {
echo "Error: Could not connect to the selected server, incorrect username or password..";
}
}else {
echo "Error: Could not connect to the selected server, SSH server IP or port wrong..";
}
?>
hope help me. thanks you