diff options
Diffstat (limited to 'libs/services.php')
-rw-r--r-- | libs/services.php | 37 |
1 files changed, 37 insertions, 0 deletions
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 @@ +<?php +require 'Utils/Config.class.php'; +$Config = new Config(); + + +$datas = array(); + +if (count($Config->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 |