1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| //initialisation de la connection au serveur distant via SSH
if($connection = ssh2_connect('localhost',22))
{
print "Connection réussie";
print "<br>";
//identification aupres du serveur distant
if(ssh2_auth_password($connection, '****', '****'))
{
print "Authentification réussie";
print "<br>";
print "<br>";
//demarrage de l'outil SQL Plus
print "Démarrage de SQL Plus ... ";
print "<br>";
$shell = ssh2_shell($connection,"xterm");
fwrite($shell, "sqlplus /nolog \n");
fwrite($shell, "connect system/manager@demoweb \n");
fwrite($shell, "startup \n");
sleep( 20 );
while( $line = fgets( $shell, 4096 ) )
{
print $line;
print "<br>";
}
}
else
{
print "Authentification echouée !";
print "<br>";
print "<br>";
}
}
else
{
print "Connection échouée !";
print "<br>";
print "<br>";
} |
Partager