1. I'm trying to get ranked skywars wins from the api but I can't find the path to it.
    I'm doing

    $json = file_get_contents('https://api.hypixel.net/player?key=(My Key)&name='.$name);

    $doc= json_decode($json, true);

    $swrw = ($doc['player']['Skywars']['wins_ranked']);

    But all I get is a blank variable. Anyone know how to do it?
     
    #1
    Last edited: Feb 4, 2020
  2. The path should be:
    PHP:
    $doc['player']['stats']['SkyWars']['wins_ranked']
    Let me know if that helped.

    Also watch out, your link in your thread still includes your private API key, try to remove that link to keep it private.
     
    #2
    Last edited: Feb 4, 2020
  3. I still don't get an output from it, I was able to do it with solo and teams wins but those are under achievements.
     
    #3
  4. Try to enable PHP error reporting, that will always help you in case of errors.

    In your case, it is probably because it is supposed to be "SkyWars", not "Skywars".

    I tried the following code and it is working:

    PHP:
    <?php
    $name 
    "minifreddusch";
    $key "";

    $json file_get_contents('https://api.hypixel.net/player?key='.$key.'&name='.$name);
    $doc json_decode($jsontrue);

    print(
    $doc['player']['stats']['SkyWars']['wins_ranked']);
    ?>
     
    #4

Share This Page