Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to telnet

Status
Not open for further replies.

Ambrotos

Programmer
Mar 8, 2004
10
0
0
CA
Ladies and Gents,

Does anyone know of how to connect to a telnet session using php. I tried going through the php manual but it confused the heck outta me.

Thanks for your assistance

Angelo
 
Read the manual about: fsockopen()

Anyway, don't forget that you can't easily use a PHP script as a terminal window. It runs, then stops. There is no connection that is constant, like in a real telnet session.
 
Anyway, don't forget that you can't easily use a PHP script as a terminal window. It runs, then stops. There is no connection that is constant, like in a real telnet session

I agree that its no use for realtime telnet, there are other uses though, like connecting to a router to get some info out (like doing 'sh proc cpu' on a cisco, outputting the comeback etc).




Triangular sandwiches taste better than square ones.

Rob
 
don't forget also that PHP can (depending on your server permissions of course) simple execute (via system(), exec(), or `` backtics) the direct telnet command.

exec("telnet to.somewhere.com");

that's not interactive though, it would only let you check the output, for instance to see if the server responded correctly.

BUT, using linux and |, you could do:

exec("echo 'sh proc cpu' | telnet to.somewhere.com");

to execute a single command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top