With this API, you can get your server informations like name of connected players, players count, numbers of votes...
The information depends on your server type. The information collected is the same as that of the widget visible in banners tab.
https://api.trackyserver.com/widget/index.php?id=XXXXXX
API response | Definition |
playerslist * |
Get a list of all nickname connected on your server |
playerscount |
Current players count and max players (if the server is offline, this variable = OFFLINE) |
country |
Get the host country code |
category |
Server category name |
map * |
Server map name |
version * |
Server version |
resources * |
Mods list installed on the server (string with seperator) |
votes |
Number of votes on trackyserver |
ip |
IP and server port |
name * |
Server name |
// Replace XXXXXX by your server id on Trackyserver.com $server_id = "XXXXXX"; // Execute curl and get server informations $url="https://api.trackyserver.com/widget/index.php?id=".$server_id; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL,$url); $result=json_decode(curl_exec($ch), true); curl_close($ch); if ($result){ // Example to print playerscount echo $result['playerscount']; // Example to loop players list foreach ($result['playerslist'] as $player){
echo $player['name'];
} // Use print_r($result); to print all informations array } else { echo "server not found"; }