タイトルをどのように付けるべきかわかりませんが、コードは次のとおりです。
if(isset($stats->playerStatus->server->serverIPv6Address)){ // prefer the IPv6 address if it's there`
$srvDetails = file_get_contents('https://api.kag2d.com/server/ip/' . $stats->playerStatus->server->serverIPv6Address . '/port/' . $stats->playerStatus->server->serverPort . '/status');
}elseif(isset($stats->playerStatus->server->serverIPv4Address)){
$srvDetails = file_get_contents('https://api.kag2d.com/server/ip/' . $stats->playerStatus->server->serverIPv4Address . '/port/' . $stats->playerStatus->server->serverPort . '/status');
}
$srvContent = json_decode($srvDetails, true);
$srvName = $srvContent->serverName;
$playerString = 'Players: ' . $srvContent->currentPlayers . '/' . $srvContent->maxPlayers;
$srvName は空のままで、$playerString はただのプレイヤーです: /例としてhttps://api.kag2d.com/server/ip/199.168.184.8/port/23002/status