Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sivasankars/9f60060c9c7490acc379 to your computer and use it in GitHub Desktop.
Save sivasankars/9f60060c9c7490acc379 to your computer and use it in GitHub Desktop.
Clash of Clans Official API Integration on PHP. You can connect with API to get details about your Clans, Location and Members
<?php
//Clash of Clans Official API Integration on PHP
//Refer : http://sivasankar.in/
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, 'https://api.clashofclans.com/v1/clans/%23LRQ0PJL9'); //Clan Tag
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Accept: application/json',
'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiIsImtpZCI6IjI4YTMxOGY3LTAwMDAtYTFlYi03ZmExLTJjNzQzM2M2Y2NhNSJ9.eyJpc3MiOiJzdXBlcmNlbGwiLCJhdWQiOiJzdXBlcmNlbGw6Z2FtZWFwaSIsImp0aSI6ImVkM2UzMjEwLTVkYmItNDQ0Ni05YzA3LTZhNjhmMDExMTc1NCIsImlhdCI6MTQ1NjUwOTI4NCwic3ViIjoiZGV2ZWxvcGVyL2Y4ZTA0MGUwLTcxNzYtMjgzYi1jY2YwLTc5NzkyMWYzN2NiYSIsInNjb3BlcyI6WyJjbGFzaCJdLCJsaW1pdHMiOlt7InRpZXIiOiJkZXZlbG9wZXIvc2lsdmVyIiwidHlwZSI6InRocm90dGxpbmcifSx7ImNpZHJzIjpbIjEyMi4xNzQuMTgzLjIxMiJdLCJ0eXBlIjoiY2xpZW50In1dfQ.x_Nhtmg6MPyEGjnMNqpG0mTwAwv8x2kAuvcnvsAGN2u1AbXFTusF1mBJvqpbsHCM7eccKFySug9BKdlOSMV_9Q'
)); // Clash of Clans API Token
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$api = curl_exec($curl);
curl_close($curl);
$coc = json_decode($api);
var_dump($coc); // Print Output
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment