PHP-Source-Query

by xPaw

🐘 PHP library to query servers that implements Source Engine Query protocol

434 Stars 134 Forks Last release: about 5 years ago (1.0.0) GNU Lesser General Public License v2.1 153 Commits 2 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

PHP Source Query

Build Status Test Coverage Packagist Downloads Packagist Version

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

:warning: Please do not create issues when you are unable to retrieve information from a server, unless you can prove that there is a bug within the library.

Requirements

Protocol Specifications

  • https://developer.valvesoftware.com/wiki/Server_queries
  • https://developer.valvesoftware.com/wiki/SourceRCONProtocol

Supported Games

AppID

Game Query RCON Notes
~ All HL1/HL2 games and mods :whitecheckmark: :whitecheckmark:
10 Counter-Strike 1.6 :whitecheckmark: :whitecheckmark:
440 Team Fortress 2 :whitecheckmark: :whitecheckmark:
550 Left 4 Dead 2 :whitecheckmark: :whitecheckmark:
730 Counter-Strike: Global Offensive :whitecheckmark: :whitecheckmark:

host_name_store 1; host_info_show 2; host_players_show 2
1002 Rag Doll Kung Fu :whitecheckmark: :whitecheckmark:
2400 The Ship :whitecheckmark: :whitecheckmark:
4000 Garry's Mod :whitecheckmark: :whitecheckmark:
17710 Nuclear Dawn :whitecheckmark: :whitecheckmark:
70000 Dino D-Day :whitecheckmark: :whitecheckmark:
107410 Arma 3 :whitecheckmark: :x: Add +1 to the server port
115300 Call of Duty: Modern Warfare 3 :whitecheckmark: :whitecheckmark:
211820 Starbound :whitecheckmark: :whitecheckmark: Call
SetUseOldGetChallengeMethod
method after connecting
244850 Space Engineers :whitecheckmark: :x: Add +1 to the server port
251570 7 Days to Die :whitecheckmark: :x:
252490 Rust :whitecheckmark: :x:
282440 Quake Live :whitecheckmark: :x: Quake Live uses the ZMQ messaging queue protocol for rcon control.
346110 ARK: Survival Evolved :whitecheckmark: :whitecheckmark:
~ Minecraft :x: :whitecheckmark:

Open a pull request if you know another game which supports Source Query and/or RCON protocols.

How to tell if the game supports Source Query Protocol?

Add your server to your favourites in Steam server browser, and if Steam can display information about your server, then the protocol is supported.

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

Also refer to examples folder to work things out.

License

PHP Source Query
Copyright (C) 2012-2015 Pavel Djundik

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.