Na razie mam coś takiego:
require_once 'conf.php'; // Plik Konfiguracyjny include('class/ssh/Net/SSH2.php'); include('class/ssh/File/ANSI.php'); $ssh = new Net_SSH2($ip,$port); if (!$ssh->login($login, $haslo)) { } //echo $ssh->exec('screen -R terminal'); $ansi = new File_ANSI(); $ansi->appendString($ssh->read('admin@home:~$')); $ssh->write("screen -R et\n"); //$ssh->setTimeout(1); $ssh->write("status\n"); $ansi->appendString($ssh->read());
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <style> body { font-size: 12px; font-family: Arial; } </style> </head> <body> <div id="loading"> </div> <script> $(document).ajaxStart(function(){ $('#loading').show(); }).ajaxStop(function(){ $('#loading').hide(); }); $( "#success" ).load( "/terminal.php", function( response, status, xhr ) { if ( status == "error" ) { var msg = "Sorry but there was an error: "; $( "#error" ).html( msg + xhr.status + " " + xhr.statusText ); } }); </script> </body> </html>
Myślałem, odświeżać w ajaxie po prostu plik z kodem przykładowo co 5 sekund, ale chyba nie będzie to dobre rozwiązanie?