From 70ed2168ddc02b4703c44b3c8166a75c27f349d8 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 16 Dec 2023 16:05:06 +0200 Subject: [PATCH] implement socket api --- src/public/socket.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/public/socket.php diff --git a/src/public/socket.php b/src/public/socket.php new file mode 100644 index 0000000..b43bed1 --- /dev/null +++ b/src/public/socket.php @@ -0,0 +1,43 @@ + 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']) + ] + ) +);