I'm trying to run an Expect script from PHP and I'm having a problem I can't seem to figure out. When I run my Expect script from CLI it runs fine... when I try and run it through PHP the script starts to log in to the device then asks, "Press any key to continue (Q to quit)", and drops out. I tried sending random keys to the script to see if it helps but it doesn't seem to accept anything passed to it once it asks for "any key". I have used PHP and Expect a bunch of times successfully on probably 15 different devices and this one vendor device is throwing me for a loop. I found very little help on this issue, and the few things that I have found said to mess with the TERM setting and it still seems to be broken even after setting that variable.
PHP Output:
[text]
spawn telnet xxx.xxx.xxx.xxx
Trying xxx.xxx.xxx.xxx...
Connected to xxx.xxx.xxx.xxx.
Escape character is '^]'.
Login:usertest
Press any key to continue (Q to quit)
[/text]
Expect Snippet:
[text]
# Log in to switch
set timeout 5
set env(TERM) vt100
spawn telnet $device
match_max 100000
expect -exact "Login:"
send -- "$username\r"
expect -exact "Password:"
send -- "$password\r"
expect -exact ">"
send -- "logout\r"
expect eof
[/text]
Any help would be awesome... thanks!