# PHP Source Query [![Packagist](https://img.shields.io/packagist/dt/xpaw/php-source-query-class.svg)](https://packagist.org/packages/xpaw/php-source-query-class) This class was created to query game server which use the Source query protocol, this includes all source games, and all the games that implement Steamworks. The class also allows you to query servers using RCON although this only works for half-life 1 and source engine games. [Minecraft](http://www.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 engine. **This library requires a [modern version](https://php.net/supported-versions.php) of PHP, so make sure you are using at least PHP 5.4 or newer.** ### Protocol specifications can be found over at VDC * https://developer.valvesoftware.com/wiki/Server_queries * https://developer.valvesoftware.com/wiki/Source_RCON_Protocol ## Supported Games AppID | Game | Query | RCON | Notes ----- | ---- | :---: | :--: | ---- ~ | All HL1/HL2 games and mods | :white_check_mark: | :white_check_mark: | 10 | [Counter-Strike 1.6](http://store.steampowered.com/app/10/) | :white_check_mark: | :white_check_mark: | 730 | [Counter-Strike: Global Offensive](http://store.steampowered.com/app/730/) | :white_check_mark: | :white_check_mark: | 440 | [Team Fortress 2](http://store.steampowered.com/app/440/) | :white_check_mark: | :white_check_mark: | 550 | [Left 4 Dead 2](http://store.steampowered.com/app/550/) | :white_check_mark: | :white_check_mark: | 1002 | [Rag Doll Kung Fu](http://store.steampowered.com/app/1002/) | :white_check_mark: | :white_check_mark: | 2400 | [The Ship](http://store.steampowered.com/app/2400/) | :white_check_mark: | :white_check_mark: | 4000 | [Garry's Mod](http://store.steampowered.com/app/4000/) | :white_check_mark: | :white_check_mark: | 17710 | [Nuclear Dawn](http://store.steampowered.com/app/17710/) | :white_check_mark: | :white_check_mark: | 70000 | [Dino D-Day](http://store.steampowered.com/app/70000/) | :white_check_mark: | :white_check_mark: | 107410 | [Arma 3](http://store.steampowered.com/app/107410/) | :white_check_mark: | :white_check_mark: | Add +1 to the server port 115300 | [Call of Duty: Modern Warfare 3](http://store.steampowered.com/app/115300/) | :white_check_mark: | :white_check_mark: | 211820 | [Starbound](http://store.steampowered.com/app/211820/) | :white_check_mark: | :white_check_mark: | Call `SetUseOldGetChallengeMethod` method after connecting 252490 | [Rust](http://store.steampowered.com/app/252490/) | :white_check_mark: | :white_check_mark: | Add +1 to the server port | [Minecraft](http://www.minecraft.net/) | :x: | :white_check_mark: | Open a pull request if you know another game which supports Source Query and/or RCON protocols. ## 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 |