I've been trying to sort out recording an interactive SSH session via a PHP CLI script. All I really want is sort of like a tee command, where the entire output is recorded into a string.
I've tried most of the commands to execute external processes to get it to work. They either work ok such as passthru
and pcntl_exec
but don't let me record the output into a string or array, or they don't display any output to my terminal but still accept stuff from STDIN.
I'm wondering if there is a way of having an interactive ssh session i.e, works normally, but actually records the output for use in PHP.
Thanks