By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,985 Members | 1,694 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,985 IT Pros & Developers. It's quick & easy.

fsockopen() and telnet

P: n/a

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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.