Raw PHP That Checks Minecraft Servers Online Or Offline

Discussion in 'Bukkit Discussion' started by ziryuk, Jan 14, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    ziryuk

    Hi, I've tried a few php scripts that checks whether an address/server is currently online or off but none has worked so far. I'm pretty sure I'm running the script correctly since it pings websites correctly, just not Minecraft servers.

    Scripts such as http://pastebin.com/P3PZbWZ0, or the ones in http://forums.bukkit.org/threads/help-working-minecraft-server-status-script-for-php.111783/ or even sites like http://gamewebb.com/msmp-server-check.php

    I tried checking my server, my friends server and a few popular servers but all of them showed as offline. Oddly enough I can't find any posts where people are complaining that it isn't working for them either. I just asked a friend to try it and it doesn't seem to work for him either.

    Any suggestions?
     
  2. Offline

    Ne0nx3r0

    Your host might be blocking fsock.

    That said, I tried to do this a few months ago and wasn't able to find a decent script that provided repeatable results of online players, etc. for a test group of servers I polled from server lists.
     
  3. Offline

    ziryuk

    Thanks for the info, I just looked that up with my host and apparently they are blocking the ports.

    Does anyone know any work-around to getting the same result without without using another website's support?
     
  4. Offline

    Adriani6

    Since a lot of people are asking for this, I'll try and develop a tool...
     
  5. Offline

    ziryuk

    That would be awesome. :)
     
  6. Offline

    TnT

  7. Offline

    Ne0nx3r0

    When I was doing something similar, I setup a cronjob on my Minecraft server to query the web site for data it needs to find periodically, then find all the data and return the results to the web site.

    In my case however this was feasible since it was a passive updating cycle. If you wanted to do this actively (ie. when a user submits a new thing) you would basically need to pay for a host that allows it. (VPS or dedicated, generally)
     
  8. Offline

    lDucks

    I've got my own checker I've been debating on releasing... Hmm....
     
    ziryuk likes this.
  9. Offline

    SatanicMC

    I use this code, it may not be pretty, but it works.

    $connection = @fsockopen("ServerIP", "ServerPort", $errno, $errstr, "TimeOutInSeconds(I use 2)");

    if(!$connection) {
    echo 'Server Offline!';
    } else {
    echo 'Server Online!';
    }
     
  10. Offline

    Bobcat00

  11. Offline

    JWhy

    Ever thought of caching this? The frequent socket opening may be fine for the Bukkit server, but it might really harm the Webserver's performance. A flatfile caching should be totally fine. PR anyone?
     
Thread Status:
Not open for further replies.

Share This Page