summaryrefslogtreecommitdiff
path: root/libs/services.php
diff options
context:
space:
mode:
authorShevAbam <shevabam@gmail.com>2014-06-18 10:11:11 +0200
committerShevAbam <shevabam@gmail.com>2014-06-18 10:11:11 +0200
commit20705a550df5b13a544dc0865c6aef16e64c99d9 (patch)
treee396dface41e30d39a68d5fe66097b1f8f641a81 /libs/services.php
+ First commit (version 2.0)v2.0
Diffstat (limited to 'libs/services.php')
-rw-r--r--libs/services.php37
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