2014-06-18 04:11:11 -04:00
|
|
|
<?php
|
|
|
|
require 'Utils/Config.class.php';
|
|
|
|
$Config = new Config();
|
|
|
|
|
|
|
|
|
|
|
|
$datas = array();
|
|
|
|
|
|
|
|
if (count($Config->get('services')) > 0)
|
|
|
|
{
|
|
|
|
foreach ($Config->get('services') as $service)
|
|
|
|
{
|
2014-06-18 04:15:18 -04:00
|
|
|
$host = $service['host'];
|
|
|
|
$sock = @fsockopen($host, $service['port'], $num, $error, 5);
|
2014-06-18 04:11:11 -04:00
|
|
|
|
|
|
|
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);
|