php3-list | 199807
Date: 07/21/98
- Next message: Cees Hek: "Re: [PHP3] GD commands."
- Previous message: Marcelo J. Iturbe: "Re: [PHP3] I get a "parse error" on EVERY php page!"
- In reply to: Adam Roderick: "[PHP3] fsockopen to a telnet port"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 20 Jul 1998, Adam Roderick wrote:
> <?
> $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?
I don't think that telnet is that simple. There is some hand shaking that
needs to be done before you will get a login prompt. Your best bet is to
read up on the protocol and go from there.
Or even simpler, use exec or system to run the telnet client on your
system and talk to it using a chat script...
By the way, why do you need to access this through telnet? There has to
be a simpler way!
Cees
-- 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
- Next message: Cees Hek: "Re: [PHP3] GD commands."
- Previous message: Marcelo J. Iturbe: "Re: [PHP3] I get a "parse error" on EVERY php page!"
- In reply to: Adam Roderick: "[PHP3] fsockopen to a telnet port"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

