Hi,
I am using Pear's Net_Ping package (Ping.php attached).
I got the example code working:
<?php
require_once 'Net_Ping/Ping.php';
$ping = Net_Ping::factory();
if(PEAR::isError($ping)) {
die($ping->getMessage());
}
$ping->setArgs(array('count' => 4));
$result = $ping->ping('yahoo.com');
echo "<pre>";
//dump the raw data
print_r($result);
echo "</pre>";
?>
and get the following output:
net_ping_result Object
(
[_icmp_sequence] => Array
(
[0] => 65
[1] => 17
[2] => 18
[3] => 17
)
[_target_ip] => 66.94.234.13
[_bytes_per_request] => 32
[_bytes_total] => 128
[_ttl] => 54
[_raw_data] => Array
(
[0] =>
[1] => Pinging yahoo.com [66.94.234.13] with 32 bytes of data:
[2] =>
[3] => Reply from 66.94.234.13: bytes=32 time=65ms TTL=54
[4] => Reply from 66.94.234.13: bytes=32 time=17ms TTL=54
[5] => Reply from 66.94.234.13: bytes=32 time=18ms TTL=54
[6] => Reply from 66.94.234.13: bytes=32 time=17ms TTL=54
[7] =>
[8] => Ping statistics for 66.94.234.13:
[9] => Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
[10] => Approximate round trip times in milli-seconds:
[11] => Minimum = 17ms, Maximum = 65ms, Average = 29ms
)
[_sysname] => windows
[_round_trip] => Array
(
[min] => 17
[avg] => 65
[max] => 29
)
[_transmitted] => 4
[_received] => 4
[_loss] => 0
)
Now my problem is that I want to use the values stored in the arrays such as max, min, avg and others, but I can't get it right.
I tried
echo $ping->_sysname;
and it works but I can't get the other variables to work.
I would appreciate if someone can help me regarding this or may be post a link to something helpfull
Thanks in advance.