Results 1 to 3 of 3

Thread: Notice: Undefined index:

  1. #1
    Fresh Spawn
    Join Date
    Oct 2016
    Posts
    5

    Exclamation Notice: Undefined index:

    Good afternoon, mine is giving this error, I would know why.

    Notice: Undefined index: clanLevel in ../rob-cloud.com.br/public_html/rob-clash/clash/the-warriors.php on line 64

    below follows my code, if you can give me a tip I am grateful.

    <!DOCTYPE html>
    <html lang="pt">
    <?php
    $clantag = " - ";

    $token = " - ";

    $url = "https://api.clashofclans.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);

    if (isset($data["reason"])) {
    $errormsg = true;
    }

    $members = $data ["memberList"];
    $clan = $data [""]

    ?>

    <head>

    <title><? echo $data["name"]; ?></title>

  2. #2
    Fresh Spawn
    Join Date
    Oct 2016
    Posts
    5

    Exclamation Notice: Undefined index:

    No one to give me a hand?
    Because of this error I can't call the API data

  3. #3
    It looks like you have only included part of your source code, and line 64 where the error has occurred isn't included. Based on the error message, you are likely expecting clanLevel to be part of an array but it doesn't exist. Try printing out the array containing it using print_r($your_array_name); and check if the values you are expecting to see are there.
    Clash Ninja - Upgrade Tracker and Guides
    https://www.clash.ninja - Forum Thread

Posting Permissions

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