PING

API - Ping

Get informations about your server
<?php
$infos = file_get_content('https://minecraft-api.com/api/ping/{ip}/{port}');
$json = file_get_content('https://minecraft-api.com/api/ping/{ip}/{port}/json');
echo $infos;
echo $json;
?>
Response from API
Plain text:

Array([version] => Array ([name] => BungeeCord 1.8.x-1.15.x [protocol] => 578) [players] => Array ([max] => 500 [online] => 250) [description] => Array (MOTD...) [favicon] => data/image ... [modinfo] => Array ([type] => FML [modList] => Array()));

JSON:

{"version": "1.16", "name": "BungeeCord 1.8.x-1.15.x" ...}

Getting status
<?php
$ping = file_get_content('https://minecraft-api.com/api/ping/status/{ip}/{port}');
$json = file_get_content('https://minecraft-api.com/api/ping/status/{ip}/{port}/json');

echo $ping;
echo $json;
?>
Response from API
Plain text:

En ligne

JSON:

{"status": "En ligne"}

Obtaining the number of connected players
<?php
$online = file_get_content('https://minecraft-api.com/api/ping/online/{ip}/{port}');
$json = file_get_content('https://minecraft-api.com/api/ping/online/{ip}/{port}/json');

echo $online;
echo $json;
?>
Response from API
Plain text:

250

JSON:

{"online": "250"}

Obtaining the number of players admitted by the server
<?php
$maxplayers = file_get_content('https://minecraft-api.com/api/ping/maxplayers/{ip}/{port}');
$json = file_get_content('https://minecraft-api.com/api/ping/maxplayers/{ip}/{port}/json');

echo $maxplayers;
echo $json;
?>
Response from API
Plain text:

500

JSON:

{"maxplayers": "500"}

Getting the Message of the Day (MOTD) with color support
<?php
$motd = file_get_content('https://minecraft-api.com/api/ping/motd/{ip}/{port}');
$json = file_get_content('https://minecraft-api.com/api/ping/motd/{ip}/{port}/json');

echo $motd;
echo $json;
?>
Response from API
Plain text:

Asylyus [BETA] Multi-Jeux [1.15.2]

JSON:

{"motd": "&a&lAsylyus - 1.15"}

Obtaining the response time (MS)
<?php
$response = file_get_content('https://minecraft-api.com/api/ping/response/{ip}/{port}');
$json = file_get_content('https://minecraft-api.com/api/ping/response/{ip}/{port}/json');

echo $response;
echo $json;
?>
Response from API
Plain text:

25

JSON:

{"response": "25"}

Getting the server image (Favicon)
<?php
$favicon = file_get_content('https://minecraft-api.com/api/ping/favicon/{ip}/{port}');
$json = file_get_content('https://minecraft-api.com/api/ping/favicon/{ip}/{port}/json');

echo $favicon;
echo $json;
?>
Response from API
Image:

Favicon Asylyus

JSON:

{"favicon": "base64..."}

Getting the version
<?php
$version = file_get_content('https://minecraft-api.com/api/ping/version/{ip}/{port}');
$json = file_get_content('https://minecraft-api.com/api/ping/version/{ip}/{port}/json');

echo $version;
echo $json;
?>
Response from API
Plain text:

BungeeCord 1.8.x-1.15.x

JSON:

{"version": "BungeeCord 1.8.x-1.15.x"}