Menu

Can't get it to work :(

2015-04-01
2015-04-01
  • Alexander Keßler

    Hello Thomas,
    is this project still alive and working ?
    I've tried several "solutions" to get your Framework running, but with no success.

    I started with adding the required db configs and the bnet api key.
    Tested the API-Key with the dev.battle.net-functions and also the Guild- & Realm-Name.
    Now I just wanted to test it, and I only get empty Arrays.
    I've tried getting single Characters and Guild-Objects from the API from different Guilds or Realms.

    Test-PHP:
    <?php

     $GLOBALS['wowarmory']['db']['driver'] = 'mysql';
     $GLOBALS['wowarmory']['db']['hostname'] = 'localhost'; 
     $GLOBALS['wowarmory']['db']['dbname'] = '<dbname>';
     $GLOBALS['wowarmory']['db']['username'] = '<user>';
     $GLOBALS['wowarmory']['db']['password'] = '<pwd>';
     $GLOBALS['wowarmory']['keys']['api'] = '<apikey>';
    
    include("./wowarmoryapi/BattlenetArmory.class.php");
    
    $armory = new BattlenetArmory('EU','Die ewige Wacht');
    $armory->setLocale('de_DE');
    $guild = $armory->getGuild('Crematoria');
    $members = $guild->getMembers('name','asc');
    var_dump($members);
    

    ?>

    Output:
    "Warning: array_keys() expects parameter 1 to be array, null given in [...]/wowarmoryapi/Guild.class.php on line 151 Warning: Invalid argument supplied for foreach() in [...]/wowarmoryapi/Guild.class.php on line 151 Warning: natsort() expects parameter 1 to be array, null given in [...]/wowarmoryapi/Guild.class.php on line 158 Warning: array_keys() expects parameter 1 to be array, null given in [...]/wowarmoryapi/Guild.class.php on line 162 Warning: Invalid argument supplied for foreach() in [...]/wowarmoryapi/Guild.class.php on line 162 NULL"

    I assume that the api is not returning a valid guild-object or the members-array in the guild-object is empty.

    Where is the error in my code ?

    Thanks in advance for your help

    P.S.: Censored some critical informations.

     
  • Alexander Keßler

    Ok, after testing the Bnet-API links manually, i've found the error.
    In the Server-Settings "Allow URL fopen" has to be set to true. Otherwise php can't fetch the data from the API.

     

Log in to post a comment.