21 lines
468 B
PHP
21 lines
468 B
PHP
<?php
|
|
/* SSH Connection Functions */
|
|
function ssh_Connect($server_ip, $username, $password) {
|
|
global $data;
|
|
$connection = new Net_SSH2($server_ip);
|
|
if (!$connection->login($username, $password)) {
|
|
return 2;
|
|
}
|
|
return $connection;
|
|
}
|
|
|
|
function ssh_sendCommand($connection, $command) {
|
|
ob_start();
|
|
//Hier wird das echo eingefangen und in die variable gespeichert.
|
|
echo $connection->exec($command);
|
|
$data = ob_get_contents();
|
|
ob_end_clean();
|
|
return $data;
|
|
}
|
|
?>
|