int lawl is over 9000
int lawl is over 9000

Reputation: 1022

Is there a way to get current/max player count of Server via Steam Web API?

I only found this, but it doesn't show the player count(I guess there has to be a way to get it since the serverbrowser can show the player count as well):

http://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=IP:PORT&format=json

=>

{
"response": {
    "success": true,
    "servers": [
        {
            "addr": "IP:PORT",
            "gmsindex": 12345,
            "appid": 730,
            "gamedir": "csgo",
            "region": -1,
            "secure": true,
            "lan": false,
            "gameport": 27015,
            "specport": 0
        }
    ]

}}

I forgot to add that I need to get this info from a PHP script / my website. My (free) hoster does not allow PHP networking functions, so I'm very limited in this respect.

If this is not possible via the Web API (as @Andy said), is there a third-party API which does that for me?

Upvotes: 2

Views: 6637

Answers (1)

Andy
Andy

Reputation: 50630

You don't get this information from the Steam Web API. Instead, you need to use the RCON protocol and issue an A2S_INFO query to get this information.

Part of the response from that query includes both the number of players on the server and the total number of players the server can hold.

Players     byte    Number of players on the server.
Max. Players    byte    Maximum number of players the server reports it can hold. 

Upvotes: 3

Related Questions