Server Status

06/03/2013 21:30 Pyrochina#1
Hi! I was just wondering how to add a server status to a site.

I would want it like this

Log In: ON (or if it's off) OFF

Rappelz Server: ON (or if it's off) OFF
Teampeak: ON (or if it's off) OFF
06/03/2013 22:48 Ne0@NCarbon#2
Something like this ?

Code:
<?php

$ip= "127.0.0.1"; //Server IP
$port= "6686"; //Server Port

@$fp = fsockopen ($ip ,$port , $errno, $errstr, 1);
if (!$fp)
echo '<b>Server:<font color="#FF0000"><b> Offline</b></font></b>';

else
echo '<b>Server:<font color="#008000"><b> Online</b></font></b>';

?>
06/03/2013 23:53 Pyrochina#3
Yes but that works...
06/04/2013 12:11 glandu2#4
You don't have to close $fp ? If it's not done automatically, you will have a bunch of opened connection to the game server never closed especially if many people use this web page. (even if the server will close them after a while)

(using fclose($fp) when online )
06/11/2013 01:47 Dyson49#5
Pyrochina... I gave you my skype by PM I'll give you the codes to an old site I coded. You can see some functions and others. Also, you can also try to use online tutorials to help you learn more
06/20/2013 15:24 neaw#6
@Ne0 :
Code:
<?php

$ip= "127.0.0.1"; //Server IP
$port= "6686"; //Server Port

@$fp = fsockopen ($ip ,$port , $errno, $errstr, 1);
if (!$fp){
     echo '<b>Server:<font color="#FF0000"><b> Offline</b></font></b>';
     fclose($fp);
}
else
     echo '<b>Server:<font color="#008000"><b> Online</b></font></b>';

?>
you still have the handle active on socket ;)