I have a server that continually outputs text immediately after logging in via SSH (it doesn't accept any commands), and I'm trying to figure out how to capture that output so I can store the data in my own log files. The read() method is capturing the data and holding it until it matches some text, but I would like for it to just dump the data to my file as it's received. Is that possible with this library? Something along these lines:
- Code: Select all
$fh = fopen('log.txt', 'a+b');
while ($line = $ssh->read()) {
fwrite($fh, $line);
// clear the read buffer here if needed, since we already have the data and don't want to consume any more memory
}
Any ideas? Thanks!
