Ping, Script ends before it's finished
| From: | Torben Dehn | Date: | Sat, 11 Jan 2003 13:36:04 +0000 |
| Subject: | Ping, Script ends before it's finished | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-17777@lists.php.net to get a copy of this message | ||
Hello !
I am tryin to make a script that will ping a whole subnet and it looks like
it works, but it does not...
It will ping around 60 to 70 computers and then it will stop.. no error just
finishes.
I am new at php so maybe i am doing something wrong ?
Any Help Would be appreciated.
Another thing.. is there anyway to set a timelimit on the exec("ping -n 1
$realip", $result); command ? because if it pings an ip where there is no
computer i will wait for several seconds before it will ping the next ip.
The script looks like this
<?php
set_time_limit(0);
for ($i=2;$i<=255;$i++)
{
$realip = "192.168.1.$i";
exec("ping -n 1 $realip", $result);
echo $i." ".$result[3]."<hr>";
$result = '';
}
?>