View Full Version : Getting PHP to interact with Telnet session

08-03-2007, 07:22 PM
I am trying to get php to dynamically interact with a telnet session, so that it will connect, get header output, execute a command, return the results, and then end the session.

For example, I might want to get it to execute:

"telnet $host 110"

output the header result, evaluate if it is a valid header, then run the following commands in the session, returning the output as strings for display and evaluation:

"user $username"
"pass $password"

I have tried using shell_exec(), passthru(), and system() just to get the initial connection headers; they all output that the connection was succesful, but don't show the headers.

1. How do I get output from a telnet session?
2. How do I send from additional commands after the session was open and return the outs from those?

I am currently working with PHP Version 5.1.6 running on Apache/2.2.2, Fedora Core 5.

08-04-2007, 03:47 AM
telnet requires a challenge-response process so you need to write a daemon that will send data to and listen for data from the telnet server, in other words you need to write your own socket server.

Might be easier to start off with one already written,
I have no knowledge of this script BTW its just the first one that google gave me..

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum