I am using Telnet in my php script to connect to a SunOS Mercury machine. Strangely, Telnet fails in the script, I get "Connect Failed:Login failed". However, from the same location that I am running the script, I can telnet from the prompt and log in successfully to the same machine using the same login credentials. Perhaps the "Login failed" error returned isnt reflecting the true problem? Find below the script I was using.
$result = $telnet->Connect('192.xxx.xx.xx','myUsr','myPasswd'); gives $result = 3 hence the error above.
Code: Select all
<?php
require_once "PHPTelnet.php";
$telnet = new PHPTelnet();
$result = $telnet->Connect('192.xxx.xx.xx','myUsr','myPasswd');
echo "Telnet connection result:$result";
echo " ";
switch ($result) {
case 0:
echo "Success success success";
break;
case 1:
echo '[PHP Telnet] Connect failed: Unable to open network connection';
break;
case 2:
echo '[PHP Telnet] Connect failed: Unknown host';
break;
case 3:
echo '[PHP Telnet] Connect failed: Login failed';
break;
case 4:
echo '[PHP Telnet] Connect failed: Your PHP version does not support PHP Telnet';
break;
}
?>
Code: Select all
[pius@appsserver ~]$ telnet 192.xxx.xxx.xx
Trying 192.xxx.xxx.xx...
Connected to 192.xxx.xxx.xx.
Escape character is '^]'.
login: *****
Password:
Last login: Tue Jun 8 09:15:29 from 193.xxx.xx.xx
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
-bash: ulimit: open files: cannot modify limit: Not owner
-bash-3.00$
-bash-3.00$
-bash-3.00$ uname -a
SunOS mercury 5.10 Generic_138888-01 sun4u sparc SUNW,SPARC-Enterprise
-bash-3.00$
Thank you for your assistance.