Advertisement
Guest User

Minecraft-List.org JSON PHP example

a guest
Jul 6th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2. $data = @file_get_contents("https://minecraft-list.org/server/4131-kiwimc-pl/json");
  3. $server = json_decode($data);
  4.  
  5. if($server->online){
  6.     echo "Address: ".$server->address."<br/>";
  7.     echo "Players online: ".$server->players->online."<br/>";
  8.     echo "Version: ".$server->version->name;
  9. }else{
  10.     echo "Server is offline.";
  11. }
  12.  
  13. // That code should print something like this:
  14. Address: kiwimc.pl
  15. Players online: 1
  16. Version: 1.16.1
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement