mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2026-06-02 14:04:57 -04:00
+ First commit (version 2.0)
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user