Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP WoW Battle.net Armory API library: Pulling data from cache in db
    text
    copied!<p>I am using this library: <a href="https://sourceforge.net/p/wowarmoryapi/home/Home/" rel="nofollow">https://sourceforge.net/p/wowarmoryapi/home/Home/</a> which seriously lacks documentation. The forums there are mostly unanswered. </p> <p>I've been able to successfully pull data from battle net's armory, specifically guild information. It is then stored in the <b>wa_guilds</b> table as a large blob in a row called <b>Data</b>. From there I'm unsure how to pull it and display it. I've tried the code below and about 100 different variations of that as well as unserialize but I'm too inexperienced. This is just past my level of knowledge.</p> <p>My Error: <b>Notice: Undefined index: object</b> I've tried name, level, rank</p> <p>New error caused by <b>print $roster->character;</b>: "Notice: Trying to get property of non-object"</p> <p>My code:</p> <pre><code>&lt;?php include('_inc.php'); // shh I'm hunting wabbits $conn = mysqli_connect("localhost", "root", "") or die(mysql_error()); mysqli_select_db($conn, "wow") or die(mysql_error()); $data = mysqli_query($conn, "SELECT Data FROM wa_guilds") or die(mysql_error()); //echo $data; print "&lt;table border cellpadding=3&gt;"; while($info = mysqli_fetch_array( $data, MYSQLI_BOTH )) { $roster = json_decode($info[0]); print $roster-&gt;character; } print "&lt;/table&gt;"; //$array = explode(',', $data); //echo $array[0]; ?&gt; </code></pre> <p>It looks like a popular library so I'm hoping someone has experience with it. </p> <p>Some data from var_dump:</p> <blockquote> <p>array(2) { [0]=> string(100000) "{"lastModified":1367433943000,"name":"Teh Fail","realm":"Zul'jin","battlegroup":"Ruin","level":25,"side":1,"achievementPoints":1195, [{"character":{"name":"Mundi","realm":"Zul'jin","battlegroup":"Ruin","class":8,"race":8,"gender":0,"level":85,"achievementPoints":12855,"thumbnail":"zuljin/65/3357249-avatar.jpg","guild":"Teh Fail","spec":{"name":"Fire","role":"DPS","backgroundImage":"bg-mage-fire","icon":"spell_fire_firebolt02","description":"Ignite enemies with balls of fire and combustive flames.","order":1}},"rank":3},{"character":{"name":"Kekeke","realm":"Zul'jin","battlegroup":"Ruin","class":4,"race":8,"gender":0,"level":85,"achievementPoints":11345,"thumbnail":"zuljin/76/3359564-avatar.jpg","guild":"Teh Fail","spec":{"name":"Combat","role":"DPS","backgroundImage":"bg-rogue-combat","icon":"ability_backstab","description":"A swashbuckler who uses agility and guile to stand toe-to-toe with enemies.","order":1}},"rank":3},{"character":{"name":"Benth","realm":"Zul'jin","battlegroup":"Ruin","class":9,"race":5,"gender":0,"level":90,"achievementPoints":13165,"thumbnail":"zuljin/252/3364348-avatar.jpg","guild":"Teh Fail","spec":{"name":"Destruction","role":"DPS","backgroundImage":"bg-warlock-destruction","icon":"spell_shadow_rainoffire","description":"A master of chaos who calls down fire to burn and demolish enemies.","order":2}},"rank":3}</p> </blockquote> <p>Edit: <b>Changed mysqli database connection lines to PDO and all is well.</b></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload