Jump to content

[REQ] MTA: Server Status PHP Script


Robert_Pope

Recommended Posts

Posted

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

No1Servers.com ~ Cheapest Hosting Solution!

( I am in no way affiliated with the staff of No1Servers - Just getting them more noticed! )

-----------------------------------

Join Northern Gaming today and get the roleplay experience you've been waiting for!

http://www.NorthernGaming.net/ (http://northerngamingtemp.webs.com/)

-----------------------------------

~ View Northern Gaming Advertisement! ~

Posted

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 ;-)

Posted

I guess he want's it for his website, not for the server himself.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

Also known as Bizzycola. In fact, if I could change my nick to that I would.

Posted
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.

No1Servers.com ~ Cheapest Hosting Solution!

( I am in no way affiliated with the staff of No1Servers - Just getting them more noticed! )

-----------------------------------

Join Northern Gaming today and get the roleplay experience you've been waiting for!

http://www.NorthernGaming.net/ (http://northerngamingtemp.webs.com/)

-----------------------------------

~ View Northern Gaming Advertisement! ~

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...