[PHP] Script executing Telnet Shell Command...

2002-07-22 Thread Kondwani Spike Mkandawire

I am trying to execute a Script running a telnet command
testing through a range of IP connections...
Here goes:

?
$str = 123.456.789.;
$count = 0;

while ($count  999){
$runTheScriptCommand...
}
?

What I want to stick into the while loop is if connection
was successful, break...  Is there a way I can check whether
telnet connection was successful on each step through the
loop or do I have to restructure my program and try
connecting to a port via fsockopen...  By the way
does anyone know what port number telnet connects to...

Spike...



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




Re: [PHP] Script executing Telnet Shell Command...

2002-07-22 Thread Miguel Cruz

On Mon, 22 Jul 2002, Kondwani Spike Mkandawire wrote:
 I am trying to execute a Script running a telnet command
 testing through a range of IP connections...
 Here goes:
 
 ?
 $str = 123.456.789.;
 $count = 0;
 
 while ($count  999){
 $runTheScriptCommand...
 }
 ?
 
 What I want to stick into the while loop is if connection
 was successful, break...  Is there a way I can check whether
 telnet connection was successful on each step through the
 loop or do I have to restructure my program and try
 connecting to a port via fsockopen...  By the way
 does anyone know what port number telnet connects to...

Telnet is port 23, and the protocol is more complicated than you might 
think. Perhaps you could look into using 'expect' (a unix utility) to 
control your telnet session. That might bring you less heartache in the 
long run.

miguel


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