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/services.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 libs/services.php (limited to 'libs/services.php') diff --git a/libs/services.php b/libs/services.php new file mode 100644 index 0000000..eaedf3a --- /dev/null +++ b/libs/services.php @@ -0,0 +1,37 @@ +get('services')) > 0) +{ + foreach ($Config->get('services') as $service) + { + $ip = 'localhost'; + $sock = @fsockopen($ip, $service['port'], $num, $error, 5); + + if ($sock) + { + $datas[] = array( + 'port' => $service['port'], + 'name' => $service['name'], + 'status' => 1, + ); + + fclose($sock); + } + else + { + $datas[] = array( + 'port' => $service['port'], + 'name' => $service['name'], + 'status' => 0, + ); + } + } +} + + +echo json_encode($datas); \ No newline at end of file -- cgit v1.2.3