Closed arcanewater closed 8 years ago
I've just realized I forgot to add a method that allows you to return the Location ID from the Location class. I'll fix that (and a few other mistakes I've noticed) later today
So far, the only way to get clans based on a location is by calling getRankList()
like this:
<?php
require_once "./ClashAPI/API.class.php";
$api = new ClashOfClans();
$results = $api->getRankList(32000094, true);
for($i = 0; $i < 10; $i++)
{
$clan = new CoC_Clan($results->items[$i]->tag);
echo $clan->getName() . "<br/>";
}
?>
This code displays the top 10 clans in Germany (location id 32000094). but it takes kinda long to load. I'll try optimize that later today, hopefully it works faster then.
Right now, the API-wrapper is sending a request to the REST API every time you want to know a clans name, description, etc. As the API always includes every information about a clan, it'd be faster to cache the information inside the class.
A more advanced clan search will be added either this or next week, too! This way, you don't have to bother using getRankList
to accompilish this.
What I mentioned above got fixed in the latest commit. Caching has been added as well to improve performance.
Along with the other commit I just published, getting the top clans should work fast.
Check this file for an example of how to work with the API. :)
Not sure i was checking but cant find a way to get clans from location. Should i declar first league or what to call getRankList? Or is this not yet possible?