Robert_Pope Posted November 28, 2011 Share Posted November 28, 2011 Hello, Well, basically I haven't been able to find any scripts that will show the status of your server. So, like... On your website, I know of www.game-monitor.com but their site is "SQL Error'd" so I can't really do much with them. So, does anyone have a PHP script that will show you the status (Online / Offline) of your MTA: SA server? Much thanks, Robert Pope AKA RicochetJr Link to comment
unknooooown Posted November 28, 2011 Share Posted November 28, 2011 How are you gonna run the resource, to show the server is offline, if the server is offline? If you know about php scripting yourself, have a look at: https://wiki.multitheftauto.com/wiki/PHP_SDK I'm sure you can find a solution for your problem. I dont know anything about php or the PHP_SDK, but shoud be possible to create something that detects when the server is online/offline. Most of it would probably have to be run on your site. Again, I am not sure about this. I am only guessing and trying to help you Link to comment
Castillo Posted November 28, 2011 Share Posted November 28, 2011 I guess he want's it for his website, not for the server himself. Link to comment
cokacola Posted November 28, 2011 Share Posted November 28, 2011 try something like this: <?php $fp = fsockopen("127.0.0.1", 22005, $errno, $errstr, 10); if (!$fp) { echo "Server is offline"; } else { echo "Server is online"; fclose($fp); } ?> If the server does not respond within 10 seconds, PHP will output "The server is offline", otherwise it will output "The server is online" Of course, replace 127.0.0.1 with your servers IP address and 22005 with your servers port. 1 Link to comment
Robert_Pope Posted November 28, 2011 Author Share Posted November 28, 2011 How are you gonna run the resource, to show the server is offline, if the server is offline? If you know about php scripting yourself, have a look at: https://wiki.multitheftauto.com/wiki/PHP_SDK I'm sure you can find a solution for your problem. I dont know anything about php or the PHP_SDK, but shoud be possible to create something that detects when the server is online/offline. Most of it would probably have to be run on your site. Again, I am not sure about this. I am only guessing and trying to help you Read the original post completely. It stated that I needed it for my website. try something like this: <?php $fp = fsockopen("127.0.0.1", 22005, $errno, $errstr, 10); if (!$fp) { echo "Server is offline"; } else { echo "Server is online"; fclose($fp); } ?> If the server does not respond within 10 seconds, PHP will output "The server is offline", otherwise it will output "The server is online" Of course, replace 127.0.0.1 with your servers IP address and 22005 with your servers port. That works! Thank you so much. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now