In this example: http://php.net/manual/en/expect.examples-usage.php, i.e.
<?php
ini_set("expect.timeout", -1);
ini_set("expect.loguser", "Off");
$stream = expect_popen("ssh root@remotehost");
while (true) {
switch (expect_expectl ($stream, array (
array ("password:", PASSWORD), // SSH is asking for password
array ("yes/no)?", YESNO), // SSH is asking whether to store the host entry
array ("~$ ", SHELL, EXP_EXACT), // We've got the shell!
))) {
case PASSWORD:
fwrite ($stream, "secret
");
break;
....
How would I output the part of $stream that expect_expectl is currently working on?
Probably I haven't completely grasped the concepts and tools to work with streams.
I want to see each line of the stream regardless if it matches or not even if that's only for debugging purposes of my script.