473,386 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 13447
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris | last post by:
Hi All, I've been puzzling over this, but can't find a satisfactory answer anywhere. I'm not sure if the problem is in my code, or if it's something to do with the PHP/Apache set-up (probably...
5
by: Jesse | last post by:
I'm having issues attempting to create an ssl connection using fsockopen. my code contains the following line . fsockopen("ssl://siteaddr",993,$errno,$errmsg,20); error message reported:...
2
by: Loopy | last post by:
I'm trying to write a script that will connect to an external site so that I can get access referer information in a database on another one of my sites. I got errors, so I tried to write a script...
9
by: fipaj1992 | last post by:
Hi! I have very big problem with fsockopen() function. It is very important... That's code: <?php $test = fsockopen ('chrome.pl', '8080'); ?>
1
by: Syl | last post by:
Hi group - I have a database table with 4 columns that hold a url. I am selecting each url and I need to check to see if it is valid. I assumed I could use the fsockopen command. I've had to...
8
by: Yoko | last post by:
So I am using php version 4.3.9 and lets say i have a file on the server called tester.php so i am using fsockopen to point to that file but it gives me a error below. $fh =...
6
by: henryrhenryr | last post by:
Hi I'm really hoping for some ideas! I have been setting up phpmailer on my server and it was working nicely on my local server so I uploaded to my live server and tested. The mystery is that...
2
by: haytham2008 | last post by:
hi every body i have this problem while i trying to send email using php i found a function <?php mail(); ?> but does not work with me since i use smtp server with user name and password
5
by: aswathip | last post by:
I am new to sockets and fsockopen(). I am trying to send SMS using a gateway. But the fsockopen always shows the following error. Warning: fsockopen() : unable to connect to alertbox.in:80 (A...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.