469,282 Members | 1,704 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

fsockopen() and telnet


I'm considering using a PHP command line script to retrieve reports from a
Linux system. My only source for the report is via telnet.

Has anybody here used fsockopen() to interactively script a telnet session
in PHP?

If so, what problems did you have to overcome. If not, does this sound
do-able?

Tom Lynn
--------
http://www.tomlynn.com
Jul 17 '05 #1
4 13166
Tom Lynn <to*******@hotmail.com> writes:
I'm considering using a PHP command line script to retrieve reports from a
Linux system. My only source for the report is via telnet.
Do you mean that you telnet to the system, get a shell, and generate
the report by executing a command or sequence of commands? Or do
you mean that you use the telnet client to connect to a certain
port and the report is generated automatically?
Has anybody here used fsockopen() to interactively script a telnet session
in PHP?

If so, what problems did you have to overcome. If not, does this sound
do-able?


Depending on what you're doing, you might need to implement the
TELNET protocol, which might involve more than you care to do.

Is there a reason for using PHP? If you need to mimic an interactive
shell session, then consider using expect, which was designed for
exactly that sort of thing.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #2
On 30 Nov 2003 13:14:33 -0700, mf***@fuhr.org (Michael Fuhr) wrote:
Tom Lynn <to*******@hotmail.com> writes:
I'm considering using a PHP command line script to retrieve reports from a
Linux system. My only source for the report is via telnet.
Do you mean that you telnet to the system, get a shell, and generate
the report by executing a command or sequence of commands? Or do
you mean that you use the telnet client to connect to a certain
port and the report is generated automatically?


I get the report using the 1st method you mention. I telnet, login and
then issue a request for the report which is echoed back to the screen.
Has anybody here used fsockopen() to interactively script a telnet session
in PHP?

If so, what problems did you have to overcome. If not, does this sound
do-able?


Depending on what you're doing, you might need to implement the
TELNET protocol, which might involve more than you care to do.

Is there a reason for using PHP? If you need to mimic an interactive
shell session, then consider using expect, which was designed for
exactly that sort of thing.


Expect sounds like a decent way to go. I'm not prepared to implement any
protocols. Are there any expect like pear packages?

Tom
Jul 17 '05 #3
Tom Lynn <to*******@hotmail.com> writes:
On 30 Nov 2003 13:14:33 -0700, mf***@fuhr.org (Michael Fuhr) wrote:
Is there a reason for using PHP? If you need to mimic an interactive
shell session, then consider using expect, which was designed for
exactly that sort of thing.


Expect sounds like a decent way to go. I'm not prepared to implement any
protocols. Are there any expect like pear packages?


I did a few quick searches on pear.php.net and www.google.com and
didn't find anything.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #4
On 30 Nov 2003 23:44:13 -0700, mf***@fuhr.org (Michael Fuhr) wrote:
Tom Lynn <to*******@hotmail.com> writes:
On 30 Nov 2003 13:14:33 -0700, mf***@fuhr.org (Michael Fuhr) wrote:
>Is there a reason for using PHP? If you need to mimic an interactive
>shell session, then consider using expect, which was designed for
>exactly that sort of thing.


Expect sounds like a decent way to go. I'm not prepared to implement any
protocols. Are there any expect like pear packages?


I did a few quick searches on pear.php.net and www.google.com and
didn't find anything.


I have come across a PHP application framework that implements telnet.

It's called Plankton and can be found at
http://www.sea-incorporated.com/plankton/index.php

Tom Lynn
--------
http://www.tomlynn.com
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Chris | last post: by
5 posts views Thread by Jesse | last post: by
2 posts views Thread by Loopy | last post: by
9 posts views Thread by fipaj1992 | last post: by
1 post views Thread by Syl | last post: by
8 posts views Thread by Yoko | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.