PHP Source Query ================ ### Description This class was created to query game server which use the Source query protocol, this includes all source games, half-life 1 engine games and Call of Duty: Modern Warfare 3 The class also allows you to query servers using RCON although this only works for half-life 1 and source engine games. [Minecraft](http://minecraft.net) also uses Source RCON protocol, and this means you can use this class to send commands to your minecraft server while having engine set to source. ##### Protocol specifications can be found over at VDC * https://developer.valvesoftware.com/wiki/Server_queries * https://developer.valvesoftware.com/wiki/Source_RCON_Protocol ### Usage You can find easy examples on how to use it in `View.php` ### Example ```php Connect( 'localhost', 27015, 3, SourceQuery :: GOLDSOURCE ); print_r( $Query->GetInfo( ) ); print_r( $Query->GetPlayers( ) ); print_r( $Query->GetRules( ) ); $Query->SetRconPassword( 'this_is_your_leet_rcon_password' ); echo $Query->Rcon( 'status' ); } catch( SQueryException $e ) { echo $e->getMessage( ); } $Query->Disconnect( ); ?> ``` ### Functions
Connect( $Ip, $Port, $Timeout, $Engine ) | Opens connection to a server |
Disconnect( ) | Closes all open connections |
Ping( ) | Ping the server to see if it exists Warning: Source engine may not answer to this |
GetInfo( ) | Returns server info in an array |
GetPlayers( ) | Returns players on the server in an array |
GetRules( ) | Returns public rules (cvars) in an array |
SetRconPassword( $Password ) | Sets rcon password for later use with Rcon() |
Rcon( $Command ) | Execute rcon command on the server |