473,372 Members | 859 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,372 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 13446
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.