Вот исходный код страницы состояния, которую я сделал для сервера Minecraft. В настоящее время он буквально пингует все 16 серверов одновременно, и, как и следовало ожидать, это делает страницу крайне медленной и разрушает ее полезность в целом.
Могу ли я увидеть примеры того, как эффективно загружать статус одного сервера за раз? Я предполагаю, что он будет использовать Ajax или что-то в этом роде. Моя идеальная настройка даже не проверит состояние сервера, пока страница не загрузится полностью. После этого он будет сканировать каждый сервер по порядку и показывать статус. Незавершенные серверы будут загружаться до тех пор, пока не наступит их очередь.
Заранее спасибо за ваши предложения. Надоело ждать 40 секунд, пока моя страница загрузится, ха-ха.
<title>AvengeTech / Network Status</title>
<?php
include "layout/_header.php";
# Lobbies
$query_JSON_19132 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19132/mcpe"), true);
$query_OnlineStatus_19132 = $query_JSON_19132["status"];
$query_ServerVersion_19132 = $query_JSON_19132["version"];
$query_OnlinePlayers_19132 = $query_JSON_19132["players"]["online"];
$query_MaxPlayers_19132 = $query_JSON_19132["players"]["max"];
$query_JSON_19133 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19133/mcpe"), true);
$query_OnlineStatus_19133 = $query_JSON_19133["status"];
$query_ServerVersion_19133 = $query_JSON_19133["version"];
$query_OnlinePlayers_19133 = $query_JSON_19133["players"]["online"];
$query_MaxPlayers_19133 = $query_JSON_19133["players"]["max"];
# Factions
$query_JSON_19120 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19120/mcpe"), true);
$query_OnlineStatus_19120 = $query_JSON_19120["status"];
$query_ServerVersion_19120 = $query_JSON_19120["version"];
$query_OnlinePlayers_19120 = $query_JSON_19120["players"]["online"];
$query_MaxPlayers_19120 = $query_JSON_19120["players"]["max"];
$query_JSON_19121 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19121/mcpe"), true);
$query_OnlineStatus_19121 = $query_JSON_19121["status"];
$query_ServerVersion_19121 = $query_JSON_19121["version"];
$query_OnlinePlayers_19121 = $query_JSON_19121["players"]["online"];
$query_MaxPlayers_19121 = $query_JSON_19121["players"]["max"];
$query_JSON_19122 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19122/mcpe"), true);
$query_OnlineStatus_19122 = $query_JSON_19122["status"];
$query_ServerVersion_19122 = $query_JSON_19122["version"];
$query_OnlinePlayers_19122 = $query_JSON_19122["players"]["online"];
$query_MaxPlayers_19122 = $query_JSON_19122["players"]["max"];
$query_JSON_19134 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19134/mcpe"), true);
$query_OnlineStatus_19134 = $query_JSON_19134["status"];
$query_ServerVersion_19134 = $query_JSON_19134["version"];
$query_OnlinePlayers_19134 = $query_JSON_19134["players"]["online"];
$query_MaxPlayers_19134 = $query_JSON_19134["players"]["max"];
$query_JSON_19135 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19135/mcpe"), true);
$query_OnlineStatus_19135 = $query_JSON_19135["status"];
$query_ServerVersion_19135 = $query_JSON_19135["version"];
$query_OnlinePlayers_19135 = $query_JSON_19135["players"]["online"];
$query_MaxPlayers_19135 = $query_JSON_19135["players"]["max"];
$query_JSON_19136 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19136/mcpe"), true);
$query_OnlineStatus_19136 = $query_JSON_19136["status"];
$query_ServerVersion_19136 = $query_JSON_19136["version"];
$query_OnlinePlayers_19136 = $query_JSON_19136["players"]["online"];
$query_MaxPlayers_19136 = $query_JSON_19136["players"]["max"];
$query_JSON_19137 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19137/mcpe"), true);
$query_OnlineStatus_19137 = $query_JSON_19137["status"];
$query_ServerVersion_19137 = $query_JSON_19137["version"];
$query_OnlinePlayers_19137 = $query_JSON_19137["players"]["online"];
$query_MaxPlayers_19137 = $query_JSON_19137["players"]["max"];
$query_JSON_19138 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19138/mcpe"), true);
$query_OnlineStatus_19138 = $query_JSON_19138["status"];
$query_ServerVersion_19138 = $query_JSON_19138["version"];
$query_OnlinePlayers_19138 = $query_JSON_19138["players"]["online"];
$query_MaxPlayers_19138 = $query_JSON_19138["players"]["max"];
# Gunwars
$query_JSON_19140 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19140/mcpe"), true);
$query_OnlineStatus_19140 = $query_JSON_19140["status"];
$query_ServerVersion_19140 = $query_JSON_19140["version"];
$query_OnlinePlayers_19140 = $query_JSON_19140["players"]["online"];
$query_MaxPlayers_19140 = $query_JSON_19140["players"]["max"];
# PvP Biome
$query_JSON_19141 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19141/mcpe"), true);
$query_OnlineStatus_19141 = $query_JSON_19141["status"];
$query_ServerVersion_19141 = $query_JSON_19141["version"];
$query_OnlinePlayers_19141 = $query_JSON_19141["players"]["online"];
$query_MaxPlayers_19141 = $query_JSON_19141["players"]["max"];
# KitPvP
$query_JSON_19142 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19142/mcpe"), true);
$query_OnlineStatus_19142 = $query_JSON_19142["status"];
$query_ServerVersion_19142 = $query_JSON_19142["version"];
$query_OnlinePlayers_19142 = $query_JSON_19142["players"]["online"];
$query_MaxPlayers_19142 = $query_JSON_19142["players"]["max"];
# Prison
$query_JSON_19145 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19145/mcpe"), true);
$query_OnlineStatus_19145 = $query_JSON_19145["status"];
$query_ServerVersion_19145 = $query_JSON_19145["version"];
$query_OnlinePlayers_19145 = $query_JSON_19145["players"]["online"];
$query_MaxPlayers_19145 = $query_JSON_19145["players"]["max"];
$query_JSON_19146 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19146/mcpe"), true);
$query_OnlineStatus_19146 = $query_JSON_19146["status"];
$query_ServerVersion_19146 = $query_JSON_19146["version"];
$query_OnlinePlayers_19146 = $query_JSON_19146["players"]["online"];
$query_MaxPlayers_19146 = $query_JSON_19146["players"]["max"];
$query_JSON_19147 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19147/mcpe"), true);
$query_OnlineStatus_19147 = $query_JSON_19147["status"];
$query_ServerVersion_19147 = $query_JSON_19147["version"];
$query_OnlinePlayers_19147 = $query_JSON_19147["players"]["online"];
$query_MaxPlayers_19147 = $query_JSON_19147["players"]["max"];
$query_JSON_19148 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19148/mcpe"), true);
$query_OnlineStatus_19148 = $query_JSON_19148["status"];
$query_ServerVersion_19148 = $query_JSON_19148["version"];
$query_OnlinePlayers_19148 = $query_JSON_19148["players"]["online"];
$query_MaxPlayers_19148 = $query_JSON_19148["players"]["max"];
?>
<h1>Network Status</h1>
<hr>
<h3>Lobbies</h3>
<br>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style="font-weight:400;">Lobby</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19132</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19132 == TRUE) {
echo "<p>$query_OnlinePlayers_19132/$query_MaxPlayers_19132</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19132 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Lobby 2</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19133</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19133 == TRUE) {
echo "<p>$query_OnlinePlayers_19133/$query_MaxPlayers_19133</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19133 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<br>
<h3>Factions</h3>
<br>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Factions Cyan</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19120</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19120 == TRUE) {
echo "<p>$query_OnlinePlayers_19120/$query_MaxPlayers_19120</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19120 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Factions Red</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19121</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19121 == TRUE) {
echo "<p>$query_OnlinePlayers_19121/$query_MaxPlayers_19121</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19121 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Factions Green</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19122</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19122 == TRUE) {
echo "<p>$query_OnlinePlayers_19122/$query_MaxPlayers_19122</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19122 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Factions Classic</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19134</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19134 == TRUE) {
echo "<p>$query_OnlinePlayers_19134/$query_MaxPlayers_19134</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19134 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Factions Classic 2</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19135</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19135 == TRUE) {
echo "<p>$query_OnlinePlayers_19135/$query_MaxPlayers_19135</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19135 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Factions Gold</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19136</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19136 == TRUE) {
echo "<p>$query_OnlinePlayers_19136/$query_MaxPlayers_19136</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19136 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Factions Purple</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19137</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19137 == TRUE) {
echo "<p>$query_OnlinePlayers_19137/$query_MaxPlayers_19137</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19137 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Factions Blue</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19138</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19138 == TRUE) {
echo "<p>$query_OnlinePlayers_19138/$query_MaxPlayers_19138</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19138 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<br>
<h3>GunWars</h3>
<br>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>GunWars</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19140</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19140 == TRUE) {
echo "<p>$query_OnlinePlayers_19140/$query_MaxPlayers_19140</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19140 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<br>
<h3>PvP Biome</h3>
<br>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>PvP Biome</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19141</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19141 == TRUE) {
echo "<p>$query_OnlinePlayers_19141/$query_MaxPlayers_19141</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19141 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<br>
<h3>KitPvP</h3>
<br>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>KitPvP</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19142</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19142 == TRUE) {
echo "<p>$query_OnlinePlayers_19142/$query_MaxPlayers_19142</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19142 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<br>
<h3>Prison</h3>
<br>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Prison A</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19145</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19145 == TRUE) {
echo "<p>$query_OnlinePlayers_19145/$query_MaxPlayers_19145</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19145 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Prison B</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19146</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19146 == TRUE) {
echo "<p>$query_OnlinePlayers_19146/$query_MaxPlayers_19146</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19146 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Prison C</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19147</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19147 == TRUE) {
echo "<p>$query_OnlinePlayers_19147/$query_MaxPlayers_19147</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19147 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<div class='paper'>
<div class='row'>
<div class='col-sm-3'>
<p style='font-weight:400;'>Prison D</p>
</div>
<div class='col-sm-3'>
<p>play.avengetech.net:19148</p>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19148 == TRUE) {
echo "<p>$query_OnlinePlayers_19148/$query_MaxPlayers_19148</p>";
} else {
echo "<p>--/--</p>";
}
?>
</div>
<div class='col-sm-3'>
<?php
if ($query_OnlineStatus_19148 == TRUE) {
echo "<p style='color:#00aa00;'><i class='fa fa-circle'></i> Online</p>";
} else {
echo "<p style='color:#aa0000;'><i class='fa fa-circle-o'></i> Unreachable</p>";
}
?>
</div>
</div>
<br>
<?php
include "layout/_footer.php";
?>
Простой пример —
Сохраните URL-адреса в объекте JavaScript —
var urls = {19132 : "https://mcapi.ca/query/play.avengetech.net:19132/mcpe",
19133 : "https://mcapi.ca/query/play.avengetech.net:19133/mcpe",
...
};
Тогда есть функция для выполнения запросов AJAX —
function mceAjax(id, URL_address){
$.ajax({
type: 'POST',
url: URL_address,
dataType: 'json',
success: function (data) {
if(data.status == TRUE) {
//put the id as the div id, so then you can use it in the selector
$('#'+id).html("<p>"+data.players.online+"/"+data.players.max+"</p>");
}
else {
$('#'+id).html("<p>--/--</p>");
}
}
});
};
И чтобы проверить каждый сервер, вы должны зациклить свой объект js —
$(function() { //when the page is loaded/ready
for(var id in urls){ //loop over each url
mceAjax(id, urls[id]); //execute the Ajax function
}
});
Используйте AJAX, чтобы получить информацию, которую вы ищете. Если вы хотите придерживаться только PHP, вы можете использовать цикл for и сделать его 16 раз.
+ Изменить if ($query_OnlineStatus_19132 == TRUE) {
с if ($query_OnlineStatus_19132) {
== ИСТИНА не нужна.
Вот как ускорить работу вашего PHP с помощью цикла For Loop:
<?php
include("layout/_header.php");
# Lobbies
//This will do it for server 19132 and 19133 as the $i<2 makes the loop stop at 2 loops and the $i++ makes the value 19132 up by 1 each loop
for($i=19132;$i<2;$i++){
${"query_JSON_".$i} = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:".$i."/mcpe"), true);
${"query_OnlineStatus_".$i} = ${"query_JSON_".$i}["status"];
${"query_ServerVersion_".$i} = ${"query_JSON_".$i}["version"];
${"query_OnlinePlayers_".$i} = ${"query_JSON_".$i}["players"]["online"];
${"query_MaxPlayers_".$i} = ${"query_JSON_".$i}["players"]["max"];
}
# Factions
for($i=19120;$i<8;$i++){
${"query_JSON_".$i} = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:".$i."/mcpe"), true);
${"query_OnlineStatus_".$i} = ${"query_JSON_".$i}["status"];
${"query_ServerVersion_".$i} = ${"query_JSON_".$i}["version"];
${"query_OnlinePlayers_".$i} = ${"query_JSON_".$i}["players"]["online"];
${"query_MaxPlayers_".$i} = ${"query_JSON_".$i}["players"]["max"];
}
# Gunwars
$query_JSON_19140 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19140/mcpe"), true);
$query_OnlineStatus_19140 = $query_JSON_19140["status"];
$query_ServerVersion_19140 = $query_JSON_19140["version"];
$query_OnlinePlayers_19140 = $query_JSON_19140["players"]["online"];
$query_MaxPlayers_19140 = $query_JSON_19140["players"]["max"];
# PvP Biome
$query_JSON_19141 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19141/mcpe"), true);
$query_OnlineStatus_19141 = $query_JSON_19141["status"];
$query_ServerVersion_19141 = $query_JSON_19141["version"];
$query_OnlinePlayers_19141 = $query_JSON_19141["players"]["online"];
$query_MaxPlayers_19141 = $query_JSON_19141["players"]["max"];
# KitPvP
$query_JSON_19142 = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:19142/mcpe"), true);
$query_OnlineStatus_19142 = $query_JSON_19142["status"];
$query_ServerVersion_19142 = $query_JSON_19142["version"];
$query_OnlinePlayers_19142 = $query_JSON_19142["players"]["online"];
$query_MaxPlayers_19142 = $query_JSON_19142["players"]["max"];
# Prison
for($i=19145;$i<4;$i++){
${"query_JSON_".$i} = json_decode(file_get_contents("https://mcapi.ca/query/play.avengetech.net:".$i."/mcpe"), true);
${"query_OnlineStatus_".$i} = ${"query_JSON_".$i}["status"];
${"query_ServerVersion_".$i} = ${"query_JSON_".$i}["version"];
${"query_OnlinePlayers_".$i} = ${"query_JSON_".$i}["players"]["online"];
${"query_MaxPlayers_".$i} = ${"query_JSON_".$i}["players"]["max"];
}
?>