- as expected when run from the UNIX command line.
When I try and call the routine from PHP - via the exec(), shell_exec() or system() function - the routine doesn't work.
The issue I am seeing - when spawning the routine from PHP is that the INPUT BUFFER (where the MATCH occurs) does not seem to "full
y" update with the data received from the server I am logging into.
Example:
Running routine from PHP - this is the output produced with EXP_INTERNAL set to "1":
Code: Select all
spawn id(5): Does `Trying 10.13.81.123...\r\r\nConnected to coveaux.atm.ca (10.13.81.123).\r\r\nEscape character is \'^]\'
.\r\r\n'
match:
pattern #1: -re `login:'? No.
Waiting for new data (50 seconds)...
TIMEOUT
Same routine from UNIX shell - this is the output produced with EXP_INTERNAL set to "1": (this is the expected output)
Code: Select all
spawn id(3): Does `Trying 10.13.81.123...\r\r\nConnected to coveaux.atm.ca (10.13.81.123).\r\r\nEscape character is \'^]\'.\r\r\n\r
\n\r\nSunOS 5.8\r\n\r\r\n\r+-----------------------------------------------------------------------+\r\n|
WARNING |\r\n| ------- |\r\n|
|\r\n| The programs and data stored on this system are licensed
to or are |\r\n| private property of this company and are lawfully available only to |\r\n| authorized users for approved purposes. Unauthorized access to any |\r\n| program or data on this system is not permitted, and any unauthorized |\r\n| access bey
ond this point may lead to prosecution. This system may be |\r\n| monitored at any time for operational reasons, therefore, if you
are |\r\n| not an authorized user, |\r\n| DO NOT ATTEMPT TO LOG IN.
|\r\n| |\r\n|
Avertissement |\r\n| ------------- |\
r\n| |\r\n| Les programmes et les donnes stocks dans
ce systme sont viss par |\r\n| une licence ou sont proprit prive de cette compagnie et ils ne sont|\r\n| acces
sibles lgalement qu\'aux usagers autoriss a des fins autoris\es.|\r\n| Il est interdit d\'y accder sans autorisation
, et tout accs non |\r\n| autoris au dela de ce point peut entrainer des poursuites. Le systme|\r\n| peut en tout temps faire l\'objet d\'une surveillance. Si vous n\'tes |\r\n| pas un usager autoris,
|\r\n| N\'ESSAYEZ PAS D\'Y ACC\311DER. |\r\n+-------------------------------
----------------------------------------+\r\nlogin: '
match:
pattern #1: -re `login:'? YES!!
<\Can anyone provide some help -- identifying any further debugging or a hint as to what could be happening.
Platform routine is running on:
Solaris 10, running PERL 5.8.7 with appropriate libraries.
Expect.pm module -> V1.20
Apache/2.2.2 (Unix) mod_ssl/2.2.2 OpenSSL/0.9.8b PHP/5.2.5