mirror of https://github.com/YGGverse/web-api.git
ghost
12 months ago
1 changed files with 43 additions and 0 deletions
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
<?php |
||||
|
||||
// Set headers |
||||
header('Access-Control-Allow-Origin: *'); |
||||
header('Content-Type: application/json; charset=utf-8'); |
||||
|
||||
// Load dependencies |
||||
require_once(__DIR__ . '/../../vendor/autoload.php'); |
||||
|
||||
// Valid port required to continue |
||||
if (empty($_GET['port']) || !\Yggverse\Net\Socket::isPort($_GET['port'])) |
||||
{ |
||||
exit( |
||||
json_encode( |
||||
[ |
||||
'success' => false, |
||||
'message' => _('valid port required') |
||||
] |
||||
) |
||||
); |
||||
} |
||||
|
||||
// Valid host required to continue |
||||
if (isset($_GET['host']) && !\Yggverse\Net\Socket::isHost($_GET['host'])) |
||||
{ |
||||
exit( |
||||
json_encode( |
||||
[ |
||||
'success' => false, |
||||
'message' => _('valid host required') |
||||
] |
||||
) |
||||
); |
||||
} |
||||
|
||||
// Connection test |
||||
exit( |
||||
json_encode( |
||||
[ |
||||
'success' => \Yggverse\Net\Socket::isOpen($_GET['host'], $_GET['port']) |
||||
] |
||||
) |
||||
); |
Loading…
Reference in new issue