Page 1 of 1

How can I ping a list of 70 ip addresses?

Posted: Thu Feb 09, 2006 4:49 pm
by jclarkkent2003
Hi guys,
How can I ping a list of 70 ip addresses? I need to ping 70 ip addresses I binded to my server to make sure they are all online.

How would I do that most easily? Is there a way to do it in php or how can i do it totally?

ip_list.txt content's
66.66.66.10
66.66.66.11
66.66.66.12
66.66.66.13

66.66.70.70
66.66.70.71
66.66.70.72
66.66.70.73
66.66.70.74

66.66.110.210
66.66.110.211
66.66.110.212
66.66.110.213

etc...

Thanks in advance, this is important!

Posted: Thu Feb 09, 2006 5:16 pm
by feyd
exec()

Posted: Thu Feb 09, 2006 5:49 pm
by jclarkkent2003
lol, now i feel stupid.....

Thanks mate~

Oh hold up, how about on a windows xp sp 2 pro computer using xampp? I don't think that works quite right.

Code: Select all

<?
set_time_limit(600); // Ten minutes
$string = "http://www.dnsstuff.com/tools/ping.ch?ip=";
$file = file("ip_list.txt");

for($k=0;$k<sizeof($file);$k++)
{

$ip = $file[$k];

exec("ping $ip"); flush();ob_flush();

//$full_ping_url = $string.$ip;
//include("$full_ping_url");

}

?>
That didn't output the ping response and ttl time... Did i miss something? Thansk~

Posted: Fri Feb 10, 2006 5:44 am
by raghavan20
try

Code: Select all

var_export(exec())
because...
PHP Manual wrote: output

If the output argument is present, then the specified array will be filled with every line of output from the command. Trailing whitespace, such as \n, is not included in this array. Note that if the array already contains some elements, exec() will append to the end of the array. If you do not want the function to append elements, call unset() on the array before passing it to exec().