Guest User

Minecraft-List.org JSON PHP example

a guest
Jul 6th, 2020
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  14. // That code should print something like this:
  15. Address: kiwimc.pl
  16. Players online: 1
  17. Version: 1.16.1
Add Comment
Please, Sign In to add comment