Advertisement
JunHiroaki

PHP

Jun 28th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2. $link = 'http://mcapi.ca/query/server/players';
  3. $json = file_get_contents($link);
  4. $json = json_decode($json, true);
  5.  
  6. $on = $json['status'] == 'true';
  7.  
  8. if($on){
  9. $players = $json['players']['online'];
  10. $players = intval($players);
  11. echo $players.' players online no MysticCraft';
  12. }else{
  13. echo 'O servidor estΓ‘ offline';
  14. }
  15.  
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement