{success, server, data, error, meta} on every route — simpler to consume from your app.
<?php
$json = file_get_contents('https://minecraft-api.com/api/v3/ping.php?ip={ip}&port={port}');
$data = json_decode($json, true);
echo $data['data']['players']['online'];
?>
{"success": true, "server": {"ip": "play.exemple.com", "port": 25565, "edition": "java"}, "data": {"online": true, "motd": "Serveur Survie", "version": {"name": "1.21", "protocol": 767}, "players": {"online": 42, "max": 100}, "favicon": "data:image/png;base64,..."}, "meta": {"responseTimeMs": 38.2}}
<?php
$json = file_get_contents('https://minecraft-api.com/api/v3/query.php?ip={ip}&port={port}');
$data = json_decode($json, true);
print_r($data['data']['players']['list']);
?>
{"success": true, "server": {"ip": "play.exemple.com", "port": 25565, "edition": "java"}, "data": {"online": true, "hostname": "Serveur Survie", "gameType": "SMP", "map": "world", "version": "1.21", "players": {"online": 42, "max": 100, "list": ["Faragnight", "Axeldu18"]}}, "meta": {"responseTimeMs": 61.4}}
<?php
$json = file_get_contents('https://minecraft-api.com/api/v3/bedrock.php?ip={ip}&port={port}');
$data = json_decode($json, true);
echo $data['data']['players']['online'];
?>
{"success": true, "server": {"ip": "play.exemple.com", "port": 19132, "edition": "bedrock"}, "data": {"online": true, "motd": {"line1": "Serveur Bedrock", "line2": null}, "version": {"name": "1.21.0", "protocol": 686}, "players": {"online": 12, "max": 100}}, "meta": {"responseTimeMs": 45.0}}
"success": true (the request to the API succeeded) but "data": {"online": false} and an "error" field with details. The quota remains 30 requests / 30 seconds per IP.