N
N
NeOn4eG2010-11-19 15:39:42
PHP
NeOn4eG, 2010-11-19 15:39:42

How to ping ip from php and display statistics?

functions of type system(); exec(); passthru(); return only one string, for example:
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
and that's it. What am I doing wrong? how to see statistics?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey, 2010-11-19
@alexxxst

exec("ping ya.ru", $out);
$out will contain an array of strings with the results

4
4dmonster, 2010-11-19
@4dmonster

exec("ping ya.ru",$cmd);
$row=count($cmd);
$res="";
for ($i=0; $i<=$row; $i++)
{
$res = $res. "\n". $cmd[$i];
};

N
NeOn4eG, 2010-11-19
@NeOn4eG

thanks for the answers, the problem was in the -i parameter ... did not display if the interval was less than 0.2 seconds.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question