Page 4 of 4 FirstFirst ... 234
Results 31 to 34 of 34

Thread: War Stats Page - Woohoo!

  1. #31

    Cool Thank

    Quote Originally Posted by Agester View Post
    You need to connect to the currentwar api to retrieve attacks. There is no previous war api, so you have to collect everything real time. Note: As soon as a new war is being searched these stats will be gone.

    $url = "" . urlencode($clantag) . "/currentwar";

    After you've succesfully connected you'll need to do something like this:

    $clan = $data["clan"];
    $clanMembers = $clan["members"];
    $opponent = $data["opponent"];
    $oppMembers =$opponent["members"];
    /* Clan Attacks*/
    foreach ($clanMembers as $members) {
        $myTag = $members["tag"];
        $myName = $members["name"];
        $myTh = $members["townhallLevel"];
        $myPos = $members["mapPosition"];
        foreach ($members["attacks"] as $attacks) {
            $myStars = $attacks["stars"];
            $myDest = $attacks["destructionPercentage"];
    /* Opponent Attacks*/
    foreach ($oppMembers as $members) {
        $oppTag = $members["tag"];
        $oppName = $members["name"];
        $oppTh = $members["townhallLevel"];
        $oppPos = $members["mapPosition"];
        foreach ($members["attacks"] as $attacks) {
            $oppStars = $attacks["stars"];
            $oppDest = $attacks["destructionPercentage"];
    thx for this code! you safe my life hahaha

    I have a question for you?

    how do you get the results of both attacks with this line of code ($oppStars = $attacks["stars"] ???

    The code always gives me the second attack

    Ex: first attack 3 second attack 2

    Is it possible to set ["0"] and ["1"]?

  2. #32
    I found it thx
    Profile Notorious MIND #PVVU92UV | Clan QC LIBRE #PVYVQVG | BK/AQ/GG57/60/22| WWW:

  3. #33
    For some reason I can't loop through the BestOpponentAttack, all I get back is the # symbol. If I dump the entire array variable it has all the data in it. Anyone else have this issue? Or is it just me.

    Didn't notice at first it was treating the bestattack data as a different array that you don't loop through just read it.
    Last edited by PhinPhan20; November 22nd, 2017 at 08:13 PM.

  4. #34
    Millennial Club KoenHeijn's Avatar
    Join Date
    Nov 2015
    Man I have absolutely no idea how all of this works, let alone speak the same English as you guys do, looks amazing and would love to have those stats of my own clan. Impressive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts