From 20705a550df5b13a544dc0865c6aef16e64c99d9 Mon Sep 17 00:00:00 2001 From: ShevAbam Date: Wed, 18 Jun 2014 10:11:11 +0200 Subject: + First commit (version 2.0) --- libs/ping.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 libs/ping.php (limited to 'libs/ping.php') diff --git a/libs/ping.php b/libs/ping.php new file mode 100644 index 0000000..1cadb70 --- /dev/null +++ b/libs/ping.php @@ -0,0 +1,25 @@ +get('ping:hosts')) > 0) + $hosts = $Config->get('ping:hosts'); +else + $hosts = array('google.com', 'wikipedia.org'); + +foreach ($hosts as $host) +{ + exec('/bin/ping -qc 1 '.$host.' | awk -F/ \'/^rtt/ { print $5 }\'', $result); + + $datas[] = array( + 'host' => $host, + 'ping' => $result[0], + ); + + unset($result); +} + +echo json_encode($datas); \ No newline at end of file -- cgit v1.3