Re: [PHP] Can PHP works with telnet?

2006-01-23 Thread Michael Crute
On 1/22/06, HoWang Wang [EMAIL PROTECTED] wrote:
 Hi all,

 Recently I got a job to write a PHP webpage to display some infomation
 which have to obtain from telnet. Telnet is the only way to query the
 software. I have made a quick search on php.net but I can't found amy
 extension support telnet. Is there any way to do so? Or it is impossible
 with PHP but can be done with external binaries?
 Please help, thanks.

 HoWang Wong

http://www.google.com/search?q=php+telnet

And remember, if all else fails you can use sockets directly to do
what you want.

-Mike

--

Michael E. Crute
Software Developer
SoftGroup Development Corporation

Linux takes junk and turns it into something useful.
Windows takes something useful and turns it into junk.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Can PHP works with telnet?

2006-01-22 Thread HoWang Wang
Hi all,

Recently I got a job to write a PHP webpage to display some infomation
which have to obtain from telnet. Telnet is the only way to query the
software. I have made a quick search on php.net but I can't found amy
extension support telnet. Is there any way to do so? Or it is impossible
with PHP but can be done with external binaries?
Please help, thanks.

HoWang Wong

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can PHP works with telnet?

2006-01-22 Thread Steve Clay
Sunday, January 22, 2006, 8:56:01 PM, HoWang wrote:
 software. I have made a quick search on php.net but I can't found amy
 extension support telnet. Is there any way to do so? Or it is impossible

Try http://www.geckotribe.com/php-telnet/ which uses fsockopen [1].
CURL [2] /claims/ telnet support, but this post [3] leads me to believe
it's pretty limited.

[1] http://us2.php.net/function.fsockopen
[2] http://us2.php.net/curl
[3] http://curl.haxx.se/mail/lib-2005-09/0013.html

Steve
-- 
http://mrclay.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can PHP works with telnet?

2006-01-22 Thread Geoff
In the php manual, in the fsockopen() page, in the user comments, I 
found this:

--
Found this php class to use telnet from here:
http://cvs.adfinis.ch/cvs.php/phpStreamcast/telnet.class.php
There's no docs and a lot of it's in french though so maybe it will 
help someone to have my working code. This code is used to telnet 
into a pix and execute the shun command.


//---telnet.class.php usage example-
   $telnet = new telnet;
// Next line is for logging.  
//By default you need to create a folder called /log and give it 
//the rights your webserver is running.
   $telnet-setLog(1,mylog);
   $telnet-set_host(myhost.myplace.com);
//You need to set the prompt to what you know its going to be,
//then call wait_prompt...which waits for what you just set
   $telnet-set_prompt(Password: );
   $telnet-connect();
   $telnet-wait_prompt();
   $telnet-write(mypassword);
//Have to change the prompt...in my example this is the 
//prompt that a pix will change to after loggin in.
   $telnet-set_prompt(pix );
   $telnet-wait_prompt();
   $telnet-write(en);
   $telnet-set_prompt(Password: );
   $telnet-wait_prompt();
   $telnet-write(enable_password);
//When you go into enable mode in a pix the prompt changes
   $telnet-set_prompt(pix# );
   $telnet-wait_prompt();
   $telnet-write(shun  . $shun_address);
   $telnet-wait_prompt();
   $telnet-write(clear xlate);
   $telnet-wait_prompt();
   $telnet-write(write mem);
   $telnet-wait_prompt();
   $telnet-write(exit);
   $telnet-disconnect();

--

In that same manual page, there is lots of other information and 
suggestions on making telnet connections.

Note that cURL will also allow telnet.

Geoff.


On 23 Jan 2006 at 9:56, HoWang Wang wrote:

 Hi all,
 
 Recently I got a job to write a PHP webpage to display some infomation
 which have to obtain from telnet. Telnet is the only way to query the
 software. I have made a quick search on php.net but I can't found amy
 extension support telnet. Is there any way to do so? Or it is impossible
 with PHP but can be done with external binaries?
 Please help, thanks.
 
 HoWang Wong
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 !DSPAM:43d445e0116957800291649!
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php