Development

How to get Arma server player count with Steam api in PHP

An under used Steam api feature is getting server information such as players, map, name, location and version. Here is how to do it using DayZ mod as an example.

The php file consists of the following:

response->servers[0];
$name = $main->name;
$address = $main->addr;
$version = $main->version;
$players = $main->players;
$map = $main->map;
$bots = $main->bots;
echo "Server: $name
Address: $address
Players: $players
Bots: $bots
Map: $map
Version: $version";

*You need a Steam api key

The $data variable has filters of appid and addr . The appid is a number steam gives to a game (730 is csgo etc), addr is the servers ip address and steamport (steamport is one more than the connection port ie 2303 2302).

To use the above script for your needs you need to edit the appid, addr and add your Steam api key. Then you can follow how i went through the array to get the data like players, map, name, location and version.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago