SHARE
TWEET

Untitled

a guest Apr 20th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function GetOnlinePlayers($ip, $port = 25565) {
  2.      // Create a CURL connection to the API.
  3.      $ch = curl_init('https://mcapi.us/server/status?ip='.$ip.'&port='.$port);
  4.      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5.      $results = curl_exec($ch);
  6.      curl_close($ch);
  7.  
  8.      // Unserialize the JSON output
  9.      $json = json_decode($results, true);
  10.  
  11.      // Return the online players
  12.      $onlineplayers = $json['players']['now'];
  13.      return $onlineplayers;
  14.    }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top