daily pastebin goal
57%
SHARE
TWEET

Clash API - Clan

nathan66669 Feb 13th, 2018 (edited) 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <?php
  3.  
  4. header("Content-Type: application/json");
  5.  
  6. if (!isset($_GET["key"])) {
  7.     echo '{"access_denied": "No "key" field!"}';
  8.     exit();
  9. }
  10.  
  11. if ($_GET["key"] == "{my key}") {
  12.     if (isset($_GET["tag"])) {
  13.         $access_token = "{my token}";
  14.         $headers = array("Authorization: Bearer " . $access_token);
  15.  
  16.         // Initiate connection with API
  17.         $ch = curl_init("https://api.clashofclans.com/v1/clans/%23" . $_GET["tag"] . "/members");
  18.         // Set the Authorization header
  19.         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  20.         // Execute the request (which also echo's it to the user)
  21.         curl_exec($ch);
  22.         // Close request
  23.         curl_close($ch);
  24.     } else {
  25.         echo '{"error": "No "tag" field!"}';
  26.     }
  27. } else {
  28.     echo '{"access_denied": "Wrong "key" field!"}';
  29. }
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