[WEB] GSQuery - Minecraft/Halflife 2 Query/RCON Library

Discussion in 'Bukkit Tools' started by Nikkii, Jan 28, 2013.

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

    Nikkii

    Hello everyone!

    Recently I wrote a class to help with querying information from my Team Fortress 2/L4D2/Minecraft servers, kind of like Steam Condenser, but with a smaller footprint and only what was needed.

    This library lets you use basic Minecraft Query/RCON (Gamespy4, which requires enable-query and Source RCON) in PHP. It also has support for Halflife2 and can easily be expanded into any game which supports some kind of socket based information system by using Protocols and the wrapper class.

    Example:
    https://github.com/nikkiii/gsquery/blob/master/test_minecraft.php

    Simply remove the 'rcon' array element to leave out rcon support.

    This will:
    1. Query information, and display it
    2. Query players and display them
    3. Show players from the 'list' command over RCON
    Github:
    https://github.com/nikkiii/gsquery

    It is EXTREMELY easy to expand on, just create a class extending GSQuery_Parent, add the required methods, create the protocols and then register the defaults/etc.

    Credits:
    • Myself, of course.
    • xPaw, original Minecraft query implementation
    • Maker of PyschoStats/PyschoQuery, reference for the Source query code.
     
    Adriani6 likes this.
  2. Offline

    Adriani6

    Interesting... *rubs his beard*
     
  3. Offline

    jsa005

    Cool. Using this for my server.

    Hmm...
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  4. Offline

    bhallowitz

    jsa005

    Your web host doesn't allow fwrite, I get the same result when I use xPaw's Minecraft Query class, which is oddly similar...
    (Note: Some code was referenced from xPaw's implementation, so most of the credit goes ot to him.)
    I think that's why. Although I may have found something weird about my host using...
    PHP:
    <?php
    if(function_exists('fwrite')) {
    echo 
    "enabled";
    }
    else {
    echo 
    "disabled";
    }
    ?>
    This code returns enabled which should mean that fwrite is enabled for use if I'm not mistaken. Please not that I know next to nothing about PHP so I could be horribly wrong.
     
  5. Offline

    Nikkii

    I know this is a little late, but...

    The RCON and Query classes are based off xPaw's, except both were adapted to fit the protocol specifications better :)

    I should also note that the only problem I've noticed is the error reporting, it really needs to be fixed/redone.

    Edit: That little piece of code won't work, since it's only checking if the function exists. Best way to check is call fsockopen on a known good host (localhost:80) and see if it works, if it works with that, but not with an outside service you're sure is up and visible from the internet, then your host filters the remote destinations/ports/etc
     
  6. Offline

    bhallowitz

    Yeah, I have talked to my hosting provider since and it turns out they do not allow fwrite on their shared web hosting, oh well.
     
Thread Status:
Not open for further replies.

Share This Page