So I’m building a status script for using fsockopen and Im looking to add a feature to it, instead of just online offline, i wanted to implement, online, offline, degraded (if it’s operating slowly), or error/bug if it’s online, but not working.
I’m not sure if the last one would be possible, but I know that degradation would be possible if the open socket takes longer than the timeout time, but is still responsive.
I hope that makes sense.
Here’s the code I’m currently using, it only does online, offline.
[php]<?php
function getStatus($ip,$port){
$socket = @fsockopen($_GET[“ip”], $_GET[“port”], $errorNo, $errorStr, 5);
if(!$socket) { ?>
Offline
<?php } else { ?>Active
<?php }} ?> <?php echo getStatus($_GET["ip"], $_GET["port"]) ?>[/php]