1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| <?php
$clantag = "id clan"; // #Clantag (capital letters)
$token = "Token";
$url = "https://api.clashroyale.com/v1/clans/".urlencode($clantag);
$ch = curl_init($url);
$headr = array();
$headr[] = "Accept: application/json";
$headr[] = "Authorization: Bearer ".$token;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headr);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
$data = json_decode($res, true);
curl_close($ch);
$clanScore = $data['clanScore'];
$clanWarTrophies = $data['clanWarTrophies'];
$requiredTrophies = $data['requiredTrophies'];
$donationsPerWeek = $data['donationsPerWeek'];
$members = $data['members'];
echo"<p>Score: ", $clanScore, "<br>GDC: ", $clanWarTrophies, "<br>Entrée: ", $requiredTrophies, "<br>Dons: ", $donationsPerWeek, "<br>Membres: ", $members, "</p>";
?> |
Partager