Jump to content

[REQ] MTA: Server Status PHP Script


Robert_Pope

Recommended Posts

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

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.

  • Like 1
Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...