I have the following code on a after record added/updated, it is displaying the return data on top the page.
It works fine on add page and edit page, and it also execute the script on inline add/edit, but here the return data is not displayed.
How can i achieve that (it is fine fo display it in a new window)..
if(!($con = ssh2_connect($server_ip, 22))){
echo "fail: unable to establish connection\n";
} else {
// try to authenticate with username root, password secretpassword
if(!ssh2_auth_password($con, "root", "password")) {
echo "fail: unable to authenticate\n";
} else {
// allright, we're in!
echo "okay: logged in...\n";
// execute a command
if (!($stream = ssh2_exec($con, "/usr/local/grepip.sh" ))) {
echo "fail: unable to execute command\n";
} else {
// collect returning data from command
stream_set_blocking($stream, true);
$data = "";
while ($buf = fread($stream,4096)) {
$data .= $buf;
}
echo "<pre>$data</pre>";
echo $data;
fclose($stream);
}
}
}
Pleasee advice
Claus