Getting started with Clash of Clans API |
Go to https://developer.clashofclans.com/. Register and set up your token. |
Demo 01 : Getting data from Clash of Clans API |
source |
in action |
- Replace <CLANTAG> with your clan tag. Find this in game on your clan screen.
- Replace <APITOKEN> with with your API token.
- $url can be any of the urls specified by API documentation.
- More reading on: curl_init, curl_setopt, curl_exec, json_decode
|
Demo 02 : Displaying the data |
source |
in action |
- Remove php header function as we are now using HTML to set the charset
- Remove var_dump function as we are now using HTML to display the results
- Add a way to display any error with fetching data from API
- Add the clan name to the <title> tag
- Add the clan data (as defined in $data variable) to a set <table>
- Loop through the member list (as defined by $members) and add to <tr> tag within a <table> for members of the clan
- More reading on: php arrays, isset, echo, foreach, HTML5
|
Demo 03 : Fixing the display |
source |
in action |
... |
Come back later ...