php3-list | 199807

[PHP3] fsockopen to a telnet port From: Adam Roderick (adam <email protected>)
Date: 07/20/98

Hey there,

I'm having some trouble connecting to a telnet port. I don't have any
trouble with this code:

<?
$file = fsockopen("server.name.com", "110"); ### 110 is the pop3 port
fputs($file, "user username\n"); ### puts in the username
fputs($file, "pass password\n"); ### puts in the password
fputs($file, "quit\n");
fpassthru($file); ### displays info
?>
  
This connects to the pop3 port on the mail server.
But this code:

<?
$file = fsockopen("server.name.com", "23"); ### 23 is the telnet port
fputs($file, "username\n"); ### puts in the username at the username
prompt
fputs($file, "password\n"); ### puts in the password at the pass word
prompt
fputs($file, "logout\n");
fpassthru($file); ### doesn't display info, but I wish it would
?>
  
For some reason the socket connection does not return any information, and
the program gets stuck when it gets to the fpassthru() line.

Any suggestions on what I'm doing wrong or a different way to do this?

Thanks,
Adam Roderick

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3