<?php require_once "./ClashAPI/API.class.php"; $api = new ClashOfClans(); $germany = new CoC_Location(0); //setting this to 0 because we set the Location using "setLocationByName" $germany->setLocationByName("Germany"); //$germany->setLocationByCode("DE"); //works as well $results = $api->getRankList($germany->getLocationId(), true); //get the clan ranklist for the given location. for ($i = 0; $i < 100; $i++) { $clan = new CoC_Clan($results->items[$i], false); //updated constructor allows passing clan-classes returned from getRankList if the second parameter is set to false echo $clan->getName() . "<br/>"; }
<?php require_once './ClashAPI/API.class.php'; $api = new ClashOfClans(); $location = new CoC_Location(0); $location->setLocationByName("Germany"); $params = array('name' => 'fox', 'minMembers' => 25, 'locationId' => $location->getLocationId()); $clans = $api->searchClan($params); echo "All Clans that meet the following criteria: name => fox, minMembers => 25, locationId = [Germany's Location ID] <br/>" . PHP_EOL; foreach ($clans->items as $clan) { $clan = new CoC_Clan($clan); echo "<img src=\"" . $clan->getBadgeUrl("small") . "\"> " . $clan->getName() . "<br/>" . PHP_EOL; }