 |
| Welcome to Elitist Jerks |
We're testing some new features on the site regarding OpenID registration and coordination with gamerDNA. If you experience any issues with registering an account, please take the time to fill out a report and send it to this e-mail address. We would appreciate any assistance you could provide in making sure everything is functioning as intended. Thanks!
If this is your first visit, please be sure to check out the FAQ and the forum rules. Users must register to post and new registrations are subject to a one day "mute" period to get acquainted with the community.
|
03/16/09, 3:46 AM
|
#51
|
|
It's Never Lupus
Dwarf Death Knight
Azjol-Nerub
|
Originally Posted by Jezz
Is there currently a script or site that allows you to search armory for all of 'x' class on 'x' realm, without being limited by searching within a guild/arena team?
|
Not yet. I may have something like this by the end of the week, but it would involve specifying several "seed characters". The basic idea is to crawl from guild to arena teams, to more guilds, to more teams, and so forth. The first theorem of six degrees of Kevin Bacon says that you should be able to get most level 80 players that belong to a guild with only a few "seeds", especially if you allow a high number (or infinite number) of jumps from guild to arena team to guild.
Keep in mind that this process makes a lot of armory requests, and in order to avoid a 12 hour IP ban, waiting between each one is required. There's no good way to get around this for a process that involves almost all new data. The only strategy I have had success with is cacheing as much data as possible, and being smart about the allowable "shelf life" of various data (i.e., items change in the short term, talents in medium term, class and race in the long term via some unlikely character name change antics).
|
|
|
|
|
03/27/09, 10:31 AM
|
#52
|
|
Glass Joe
Orc Shaman
Les Sentinelles (EU)
|
I just want to thank you all of us (espacially Tanoh for helping me  ), for doing such great job.
It helps many guilds.
|
|
|
|
|
|
03/31/09, 5:02 AM
|
#53
|
|
Glass Joe
Erkolm
Tauren Druid
Non-US/EU Server
|
Getting I-Levels from Armory
Hey guys,
I have a very special question concerning reading out data from the armory, and I hope it's alright if i hijack this thread for it:
Is there any way of easily reading out a character's item data, especially itemlevel, without having to look up every item manually? Ideally, the end result would be along these lines:
CHARNAME
GUILD
SERVER
10x Ilevel 226
5x Ilevel 213
1x Ilevel 200
Is there any possible way at all of achieving this, or is it pretty much unthinkable?
thanks in advance
|
|
|
|
|
|
03/31/09, 6:53 AM
|
#54
|
|
Awesome, Captain Coffee!
Draenei Priest
Gul'dan (EU)
|
Take a look at the Source of the Characters-Page. It says something like this for an Item:
<item durability="60" gem0Id="41401" gem1Id="40048" gem2Id="0" icon="inv_crown_01" id="40447" maxDurability="60" permanentenchant="3819" randomPropertiesId="0" seed="0" slot="0"/>
Now you have to extract the id value and start new requests on the Items-Page with that value to get the level. A simple relation. [characterpage/items[n]/@id]--[itempage/item/@id]
<item icon="..." id="40447" level="226" name="..." quality="4" type="...">
|
|
|
|
|
|
06/16/09, 11:09 AM
|
#55
|
|
Glass Joe
Tauren Warrior
Wrathbringer (EU)
|
Hi,
I successfully build a small guildroster so far no real problem. My next step would be to read out the achievementprogress for our members and that's where I need a little help, perhaps just a show in the right direction would help.
I want to track which achievements for example are missing for Glory of the Ulduar Raider, but the sourcecode of the achievementpage only shows the overview and categories like
<rootCategories>
<category id="92" name="Allgemein"/>
<category id="96" name="Quests">
<category name="Classic"/>
<category name="The Burning Crusade"/>
<category name="Wrath of the Lich King"/>
</category>
How can I "ask" the armory if a single achievement was achieved or not?
|
|
|
|
|
|
06/16/09, 12:24 PM
|
#56
|
|
Von Kaiser
Draenei Shaman
Burning Blade
|
Add c=X where X is the id of the category you want to look at. For example Dungeon and Raids achievements are 168. So to see your xml: http://eu.wowarmory.com/character-ac...ies+Irae&c=168
I'm unaware of how to break it down to only show a category within a category.
|
|
|
|
|
|
06/16/09, 3:26 PM
|
#57
|
|
Glass Joe
Blood Elf Paladin
Firetree
|
i've set up something like this for my guild, the only thing you can do really is look for the 'glory of the ulduar raider' meta achievement id (10man 2957, 25man 2958) from the page zimeron linked for each person. to determine if somebody has an achievement or not simply look for a 'dateCompleted' entry for the meta. if its not set then check each criteria from the meta achievement for the same dateCompleted.
an example is here Pie Chart Glory of the Raider Status (10 & 25). this is just a static page from the actual php script, since it takes a bit to load (40ish seconds)
|
|
|
|
|
|
06/18/09, 3:40 AM
|
#58
|
|
Von Kaiser
|
I worked on setting up an automated tracker for my guild tonight. I started with the script D1g1talS0ul posted. It's worth noting if you're starting with his post, the achievement structures have changed from what he's got so that why for example the battleground print out in it won't print anything.
I made a database table consisting of fourteen rows, one for the toon's name and the other 13 for each achievement for the meta. The first file updates the table from the armory. I have it set as a cron job to run every 6 hours.

#!/usr/bin/php
<?php
/*
Heroic Achievements
-------------------
0 => Heroic: Orbit-uary
1 => Heroic: Stokin' the Furnace
2 => Heroic: Iron Dwarf, Medium Rare
3 => Heroic: Heartbreaker
4 => Heroic: I Choose You, Steelbreaker
5 => Heroic: Disarmed
6 => Heroic: Crazy Cat Lady
7 => Heroic: I Could Say That This Cache Was Rare
8 => Heroic: Lose Your Illusion
9 => Heroic: Knock, Knock, Knock on Wood
10 => Heroic: Firefighter
11 => Heroic: I Love the Smell of Saronite in the Morning
12 => Heroic: One Light in the Darkness
*/
// Include phpbb's config for db info
include("config.php");
echo 'Working...' . '</br>';
/*
roster_gen class posted by D1g1talS0ul on elitistjerks.com
*/
class roster_gen {
const BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";
public $query;
public $server;
public $guild;
public $guildie;
public $page;
public function __construct ( $query, $server, $guild, $guildie, $page ) {
$this->query = $query;
$this->server = $server;
$this->guild = $guild;
$this->guildie = $guildie;
$this->page = $page;
} // end of __construct()
public function pull_xml() {
if( $this->query === 'roster' ) {
$url = 'http://www.wowarmory.com/guild-info.xml?r=' . $this->server . '&n=' . $this->guild. '&p=' . $this->page;
} elseif( $this->query === 'character' ) {
$url = 'http://www.wowarmory.com/character-sheet.xml?r=' . $this->server . '&n=' . $this->guildie;
} elseif( $this->query === 'achievements' ) {
$url = 'http://www.wowarmory.com/character-achievements.xml?r=' . $this->server . '&cn=' . $this->guildie . '&gn=' .
$this->guild . '&c=168';
}
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_USERAGENT, roster_gen::BROWSER);
$url_string = curl_exec($ch);
return simplexml_load_string($url_string);
curl_close($ch);
} // end of pull_xml()
} // end class
$roster = new roster_gen (roster, Gilneas, Anonymous, NULL, 1);
$xml_roster = $roster->pull_xml();
// Change to querying achievements
$roster->query=achievements;
// Set up the member array
$member_data = array();
$id = 0;
foreach ($xml_roster->guildInfo->guild->members->character as $char)
{
if ($char['rank'] >= 1 && $char['rank'] <= 3 && $char['name'] != 'Semic' ) {
$roster->guildie = $char['name'];
$xml_char = $roster->pull_xml();
$ach = find_category($xml_char->category);
$a = array();
$a[0] = check_achievement($ach, 0);
$a[1] = check_achievement($ach, 1);
$a[2] = check_achievement($ach, 2);
$a[3] = check_achievement($ach, 3);
$a[4] = check_achievement($ach, 4);
$a[5] = check_achievement($ach, 5);
$a[6] = check_achievement($ach, 6);
$a[7] = check_achievement($ach, 7);
$a[8] = check_achievement($ach, 8);
$a[9] = check_achievement($ach, 9);
$a[10] = check_achievement($ach, 10);
$a[11] = check_achievement($ach, 11);
$a[12] = check_achievement($ach, 12);
$member_data[$id] = array(
'name' => $char['name'],
'0' => $a[0],
'1' => $a[1],
'2' => $a[2],
'3' => $a[3],
'4' => $a[4],
'5' => $a[5],
'6' => $a[6],
'7' => $a[7],
'8' => $a[8],
'9' => $a[9],
'10' => $a[10],
'11' => $a[11],
'12' => $a[12]
);
// Provide some output that it's doing stuff
echo 'Updated: <b>' . $char['name'] . '</b> ' . $a[0] . '-' . $a[1] . '-' . $a[2] . '-' . $a[3] . '-' . $a[4] . '-' . $a[5] . '-' . $a[6]
. '-' . $a[7] . '-' . $a[8] . '-' . $a[9] . '-' . $a[10] . '-' . $a[11] . '-' . $a[12] . '</br>';
$id++;
}
}
echo '</br>Inserting values into DB...</br>';
// Connect to the DB
$db = mysql_connect('localhost', $dbuser, $dbpasswd);
$db_selected = mysql_select_db($dbname, $db);
foreach ($member_data as $member)
{
$name = $member['name'];
$sql = "insert into ach_data(name, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
VALUES ('$name', $member[0], $member[1], $member[2], $member[3], $member[4], $member[5], $member[6],
$member[7], $member[8], $member[9], $member[10], $member[11], $member[12])";
$result = mysql_query($sql);
if(!$result);
echo mysql_error() . "\n";
}
echo 'Database update completed.';
function find_category($xml)
{
foreach($xml->achievement as $ach) {
if($ach['id'] == 2958)
return $ach;
}
}
function check_achievement($achievement, $num) {
if($achievement->criteria[$num]['date'] != NULL)
return 1;
else
return 0;
}
?>
Second file is the actual display of the achievements:

<?php
// Includes
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
// Page Settings
$title = 'Achievement Progress';
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
$sql = 'SELECT name, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 FROM ach_data ORDER BY name';
$result = $db->sql_query($sql);
$row_switch = 1;
while ($row = $db->sql_fetchrow($result))
{
$name = $row['name'];
if($row_switch % 2 == 0)
$color = 'bgcolor=#EAEADA';
else
$color= 'bgcolor=#FFFFFF';
$template->assign_block_vars('member_row', array(
'NAME' => $name,
'COLOR' => $color,
'A0' => ach_icon($row['a0']),
'A1' => ach_icon($row['a1']),
'A2' => ach_icon($row['a2']),
'A3' => ach_icon($row['a3']),
'A4' => ach_icon($row['a4']),
'A5' => ach_icon($row['a5']),
'A6' => ach_icon($row['a6']),
'A7' => ach_icon($row['a7']),
'A8' => ach_icon($row['a8']),
'A9' => ach_icon($row['a9']),
'A10' => ach_icon($row['a10']),
'A11' => ach_icon($row['a11']),
'A12' => ach_icon($row['a12'])
));
$row_switch = $row_switch + 1;
}
// Output page
page_header($title);
$template->set_filenames(array(
'body' => 'achievements.html')
);
page_footer();
function ach_icon($v)
{
if($v == 1)
return "http://www.kemortia.com/pm.jpg";
else
return "http://www.kemortia.com/pf.jpg";
}
?>
Finally, a template file:

<!-- INCLUDE overall_header.html -->
<div style="float: left; width: 100%;" >
<table style="margin-left: auto; margin-right: auto;" cellspacing="0px" frame="border">
<caption align="bottom">
Heroic: Glory of the Ulduar Raider
</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/inv_misc_shadowegg.jpg" title="Orbit-uary" height="25" width="25" align="center"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_ignis_01.jpg" title="Stokin' the Furnace" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_dungeon_ulduarraid_irondwarf_01.jpg" title="Iron Dwarf, Medium Rare" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/inv_valentinescardtornleft.jpg" title="Heartbreaker" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_theironcouncil_01.jpg" title="I Choose You, Steelbreaker" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/ability_warrior_disarm.jpg" title="Disarmed" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_auriaya_01.jpg" title="Crazy Cat Lady" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_hodir_01.jpg" title="I Could Say That This Cache Was Rare" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_thorim.jpg" title="Lose Your Illusion" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_warpsplinter.jpg" title="Knock, Knock, Knock on Wood" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/inv_misc_bomb_04.jpg" title="Firefighter" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/achievement_boss_generalvezax_01.jpg" title="I Love the Smell of Saronite in the Morning" height="25" width="25"></th>
<th scope="col"><img src= "http://www.wowarmory.com/wow-icons/_images/51x51/spell_shadow_shadesofdarkness.jpg" title="One Light in the Darkness" height="25" width="25"></th>
</tr>
</thead>
<!-- BEGIN member_row -->
<tr {member_row.COLOR}>
<td style="text-align: center">{member_row.NAME}</td>
<td align="center"><img src="{member_row.A0}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A1}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A2}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A3}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A4}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A5}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A6}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A7}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A8}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A9}" height="15" width="15" ></td>
<td align="center"><img src="{member_row.A10}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A11}" height="15" width="15"></td>
<td align="center"><img src="{member_row.A12}" height="15" width="15"></td>
</tr>
<!-- END member_row -->
</table>
</div>
<!-- INCLUDE overall_footer.html -->
It seems to work pretty well. Feel free to use this code as a starter, just give me some credit if you do. Hopefully this will help some of you guys that are trying to get something similar up. Couple of weird quirks I had to work out that are worth nothing. First, for everyone except one person, the achievement category was 20, but for one it was 19. So I wrote a function in to find which category it was in the xml. Was annoying to figure that one out. The armory seems to be majorly bugged with my guild also, it has our guild leader as someone who hasn't been in the guild for years, and it has a member as a raider who also hasn't been in the guild for a long time. Hence the custom checks in the update file. Feel free to just edit those out, you'll have to change the ranks in the same line anyways most likely. I don't claim my code is the best way to accomplish what I did, so use it at your own risk :P
Finished product: Anonymous - Achievement Progress
|
Eek, Shaman
|
|
|
|
06/24/09, 11:03 AM
|
#59
|
|
Glass Joe
Gnome Mage
Shadowsong (EU)
|
Also been working on tracking dungeon meta achievement. What i have done so far is similar to the above only that it works for any guild and lets you select guild ranks to be shown. Working in asp.net so if anyone want some help to set it up with that instead of php feel free to contact me.
Can see the current status of it here: www.wow-stat.com
|
|
|
|
|
|
07/05/09, 1:33 PM
|
#60
|
|
Glass Joe
Draenei Shaman
Stormrage (EU)
|
Kemortia, your script is absolute brilliant. I edited it to pull the champion of the frozen wastes info which works an absolute treat BUT I've tried editing it to display the naxxramas normal meta and to no prevail i cant get it working at all
the error I am receiving is:
Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147
Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147
Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147
Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147
Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147
Notice: Trying to get property of non-object in C:\wamp\www\naxx.php on line 147
Updated: Rabbitpt 0-0-0-0-0-0
and my script is:

#!/usr/bin/php
<?php
/*
// Include phpbb's config for db info
//include("config.php");
echo 'Working...' . '</br>';
/*
roster_gen class posted by D1g1talS0ul on elitistjerks.com
*/
class roster_gen {
const BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";
public $query;
public $server;
public $guild;
public $guildie;
public $page;
public function __construct ( $query, $server, $guild, $guildie, $page ) {
$this->query = $query;
$this->server = $server;
$this->guild = $guild;
$this->guildie = $guildie;
$this->page = $page;
} // end of __construct()
public function pull_xml() {
if( $this->query === 'roster' ) {
$url = 'http://eu.wowarmory.com/guild-info.xml?r=' . $this->server . '&n=' . $this->guild. '&p=' . $this->page;
} elseif( $this->query === 'character' ) {
$url = 'http://eu.wowarmory.com/character-sheet.xml?r=' . $this->server . '&n=' . $this->guildie;
} elseif( $this->query === 'achievements' ) {
$url = 'http://eu.wowarmory.com/character-achievements.xml?r=' . $this->server . '&cn=' . $this->guildie . '&gn=' .
$this->guild . '&c=168';
}
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt ($ch, CURLOPT_USERAGENT, roster_gen::BROWSER);
$url_string = curl_exec($ch);
return simplexml_load_string($url_string);
curl_close($ch);
} // end of pull_xml()
} // end class
$roster = new roster_gen ('roster', 'stormrage', 'heroes+of+warcraft', NULL, 1);
$xml_roster = $roster->pull_xml();
// Change to querying achievements
$roster->query='achievements';
// Set up the member array
$member_data = array();
$id = 0;
foreach ($xml_roster->guildInfo->guild->members->character as $char)
{
if ($char['level'] == 80 && $char['rank'] <= '3' ) {
$roster->guildie = $char['name'];
$xml_char = $roster->pull_xml();
$ach = find_category($xml_char->category);
$a = array();
$a[0] = check_achievement($ach, 0);
$a[1] = check_achievement($ach, 1);
$a[2] = check_achievement($ach, 2);
$a[3] = check_achievement($ach, 3);
$a[4] = check_achievement($ach, 4);
$a[5] = check_achievement($ach, 5);
$member_data[$id] = array(
'name' => $char['name'],
'0' => $a[0],
'1' => $a[1],
'2' => $a[2],
'3' => $a[3],
'4' => $a[4],
'5' => $a[5]
);
// Provide some output that it's doing stuff
echo 'Updated: <b>' . $char['name'] . '</b> ' . $a[0] . '-' . $a[1] . '-' . $a[2] . '-' . $a[3] . '-' . $a[4] . '-' . $a[5] . '</br>';
$id++;
}
}
/*
echo '</br>Inserting values into DB...</br>';
// Connect to the DB
$db = mysql_connect($dbhost, $dbuser, $dbpasswd);
$db_selected = mysql_select_db($dbname, $db);
foreach ($member_data as $member)
{
$name = $member['name'];
$sql = "insert into ach_data(name, a0, a1, a2, a3, a4, a5)
VALUES ('$name', '$member[0]', '$member[1]', '$member[2]', '$member[3]', '$member[4]', '$member[5]')";
$result = mysql_query($sql);
if(!$result);
echo mysql_error() . "\n";
}
echo 'Database update completed.';
*/
function find_category($xml)
{
foreach($xml->achievement as $ach) {
if($ach['id'] == 576)
return $ach;
}
}
function check_achievement($achievement, $num) {
if($achievement ['dateCompleted'] != NULL)
return 1;
else
if($achievement->criteria[$num]['date'] != NULL)
return 1;
else
return 0;
}
?>
if you could help me fix this it would be great as then i could get working on something for my forum to pull ALL achievements for my guildies and then I will start on my custom armory too
btw heres a link showing what the outcome is of my working script Heroes Of Warcraft • Achievement Progress
Last edited by talonos : 07/05/09 at 9:16 PM.
Reason: fixed grammer seeing as i recieved an infraction :(
|
|
|
|
|
|
07/06/09, 1:04 PM
|
#61
|
|
Glass Joe
Draenei Shaman
Stormrage (EU)
|
Ok the problem i'm having is the tags. Thats why my script is not working. if anyone knows a way to get past this problem please feel free to assist me and others with this problem
|
|
|
|
|
|
07/06/09, 7:36 PM
|
#62
|
|
Glass Joe
Gnome Mage
Shadowsong (EU)
|
Originally Posted by talonos
Ok the problem i'm having is the tags. Thats why my script is not working. if anyone knows a way to get past this problem please feel free to assist me and others with this problem
|
The meta achievements that are working with that script are the ones listed directly in "Dungeon & raids" as you open the achievement tab ingame. The one you are trying to pull (id576) is listed in a sub section (Lich King Raid).
I dont have the output from dungeon achievements infront of me at the moment but if i am remembering the tags correctly this might work:
Edit: Thinking about it you will have to go thru the sub sections i think
function find_category($xml)
{
foreach($xml->category as $cat)
{
foreach($cat->achievement as $ach)
{
if($ach['id'] == 576)
return $ach;
}
}
}
Last edited by Targaryen : 07/06/09 at 7:47 PM.
|
|
|
|
|
|
07/06/09, 9:06 PM
|
#63
|
|
Don Flamenco
Draenei Paladin
Tichondrius
|
You do not want to go off of the meta's sub achievements when doing this because they do not update properly.
|
Confidence is not Arrogance.
|
|
|
|
07/08/09, 11:02 AM
|
#64
|
|
Glass Joe
Tauren Druid
Frostmane (EU)
|
Hey,
I coded a php xml grabber using CURL but alot of the time I get this error:
|
Fatal error: Call to a member function children() on a non-object in
|
then the document location and obviously line number.
the line it refers to is:
foreach ($guildxml->guildInfo->guild->members->children() as $char) {
basically when the foreaches start.
Is anyone else having this problem?
Thanks. 
|
|
|
|
|
|
07/08/09, 5:41 PM
|
#65
|
|
Glass Joe
Night Elf Druid
Stormrage
|
I'm no php expert (in fact, I'm using this to brush up on skills...) - so the following is just some educated guesses, but..
You're calling the function based off of the xml object referencing it - if you're having any errors with the xml object itself, the function won't work. Are you able to reliably manipulate that xml object previous to the foreach?
Secondly - your code varies only slightly from the one I'm using. Is there any specific reason you're using the children() function to begin with? The last time I looked at the raw XML, the only child of the members tag is the character tag itself, so you should be able to get away with this:
foreach ($xml->guildInfo->guild->members->character as $char)
I can't see why this would not cause an error and your call would, but maybe if this fails you'll get something different and find your solution...
Hope that winds up being helpful!
|
|
|
|
|
|
07/09/09, 11:40 AM
|
#66
|
|
Don Flamenco
Dwarf Warrior
Eredar (EU)
|
I took the class from digitalsoul a step further and added language abilities. Depending on region you need to adjust the armory server and the language you want the response to be in. Make sure you have some kind of replace script that will replace every space with "+" otherwise you will get wrong results. No space in the url is allowed. Other than that make sure to set the content type to UTF-8.

<?
header('Content-Type: text/html; charset=utf-8');
function replace_space($str) {
return str_replace(" ","+",$str);
}
//lang = en, us or de
$lang = 'de';
$armory_server = 'http://eu.wowarmory.com/';
$guild_name = 'The Dark Masters of G';
$guild_name = replace_space($guild_name);
$guild_server = 'Eredar';
$armory_url = $armory_server.'guild-info.xml?r='.$guild_server.'&gn='.$guild_name;
class guild_data
{
public $url;
public function __construct ($url)
{
$this->url = $url;
}
public function get_xml($lang)
{
$ch = curl_init();
if ($lang == 'de')
$header[] = 'Accept-Language: de-de';
elseif ($lang == 'en')
$header[] = 'Accept-Language: en-gb';
elseif ($lang == 'us')
$header[] = 'Accept-Language: en-us';
$browser = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
curl_setopt ($ch, CURLOPT_URL, $this->url);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_USERAGENT, $browser);
$url_string = curl_exec($ch);
return simplexml_load_string($url_string);
curl_close($ch);
}
public function print_url() {
return $this->url;
}
}
$guild_data = new guild_data($armory_url);
$xml_guild_data = $guild_data->get_xml($lang);
echo $guild_data->print_url();
echo '<br>';
$num_guildies = $xml_guild_data->guildInfo->guild->members['memberCount'];
echo 'num: '.$num_guildies;
echo '<br>';
echo '<pre>';
var_dump($xml_guild_data);
echo '</pre>';
?>
Last edited by zork : 07/09/09 at 12:00 PM.
|
|
|
|
|
07/13/09, 5:21 AM
|
#67
|
|
Glass Joe
Tauren Druid
Frostmane (EU)
|
Zork Do you have the php pages you posted examples of in the first post of this thread? The links are dead :P
Would be good for people to see them to exercise some sort of learning curve.
|
|
|
|
|
|
07/14/09, 12:39 PM
|
#68
|
|
Glass Joe
|
Originally Posted by sleevenote
Hey guys,
I have a very special question concerning reading out data from the armory, and I hope it's alright if i hijack this thread for it:
Is there any way of easily reading out a character's item data, especially itemlevel, without having to look up every item manually? Ideally, the end result would be along these lines:
CHARNAME
GUILD
SERVER
10x Ilevel 226
5x Ilevel 213
1x Ilevel 200
Is there any possible way at all of achieving this, or is it pretty much unthinkable?
thanks in advance
|
this is a rough first draft that doesnt do any object oriented stuff, just plain php scripting (made for php 5)
(the page contains the form to be filled out, so just run it as is)

<?php
if (isset($_GET['name']) && isset($_GET['realm']))
{
$search = true;
}
else $search = false;
if($search == true)
{
$BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";
$char_url = 'http://www.wowarmory.com/character-sheet.xml?r='.$_GET['realm'].'&n='.$_GET['name'];
//init curl session for character sheet information
$ch = curl_init();
//set curl to return data instead of printing to browser
curl_setopt ($ch, CURLOPT_URL, $char_url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_USERAGENT, $BROWSER);
//execute the fetch
$xml = curl_exec($ch);
//Close the curl connect
curl_close($ch);
$xml_obj = simplexml_load_string($xml);
//Set the character's info into variables.
$name = $xml_obj->characterInfo->character['name'];
$level = $xml_obj->characterInfo->character['level'];
$class = $xml_obj->characterInfo->character['class'];
$guild = $xml_obj->characterInfo->character['guildName'];
$lastonline = $xml_obj->characterInfo->character['lastModified'];
$items = $xml_obj->characterInfo->characterTab->items;
//Array of item levels that will be searched for
$levelsOfInterest = array(187,200,213,219,226,232,239);
//Number of items below 187
$offGear = 0;
//Display the character info
echo '<b>' . $name . '</b> - ' . $level . ' ' . $class . '<br/><i>' . $guild . '</i><br/>' . 'Last Online: ' .$lastonline . '<br/>'.'<br/>';
//init curl session for item information
$ch = curl_init();
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt ($ch, CURLOPT_USERAGENT, $BROWSER);
//Create the array containing the item levels of the character's gear.
$item_array = array();
foreach($items->item as $i)
{
$item_url = 'http://www.wowarmory.com/item-info.xml?i='.$i['id'];
curl_setopt ($ch, CURLOPT_URL, $item_url);
$xml_item = curl_exec($ch);
$xml_obj_item = simplexml_load_string($xml_item);
$itemLevel = $xml_obj_item->itemInfo->item['level'];
if($itemLevel < 187)
{
$offGear += 1;
}
array_push($item_array,(int)$itemLevel);
}
curl_close($ch);
//tabard and shirt will almost certainly be < 187, so we consider only if character has more than 2 low level items
if($offGear > 2)
{
echo 'Character may be purposely wearing non-optimal gear (fishing, pvp, festival, etc).<br/><br/>';
}
//Print out the item count
foreach($levelsOfInterest as $i)
{
$count = count(array_keys($item_array,$i));
if($count > 0)
{
echo '<i>' . $count . 'x iLevel '. $i . '</i><br/>';
}
}
}
else
{
?>
<form method="get" action="<?php print $_SERVER['PHP_SELF']?>">
<p>Name <input type="text" name="name"></p>
<p>Realm <input type="text" name="realm"></p>
<p><input type="submit" name="search"></p>
</form>
<?php
}
?>
i'm going to spend a little bit of my spare time over the next few days making a cleaner version of this using some of the classes presented in this thread or adaptations of those. (i tried phpArmory with no success, so i'm playing around with that as well)
Last edited by bloodrune : 07/14/09 at 3:39 PM.
|
|
|
|
|
|
07/15/09, 11:06 AM
|
#69
|
|
Don Flamenco
Dwarf Warrior
Eredar (EU)
|
Last edited by zork : 07/15/09 at 11:15 AM.
|
|
|
|
|
07/15/09, 12:38 PM
|
#70
|
|
Glass Joe
Tauren Druid
Frostmane (EU)
|
Excellent tutorial Zork!
-SentriX
Edit: I also had trouble with a file right out of the box:
Warning: curl_setopt() [function.curl-setopt]: You must pass either an object or an array with the CURLOPT_HTTPHEADER, CURLOPT_QUOTE, CURLOPT_HTTP200ALIASES and CURLOPT_POSTQUOTE arguments in *path-changed*/get_char_data_xml.php on line 24
, , , , ,
Warning: Invalid argument supplied for foreach() in /*path-changed*/get_char_data_xml.php on line 49
|
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
is line 24
foreach($xml_char_data->characterInfo->characterTab->professions->skill as $skill) {
is line 49
Last edited by SentriX : 07/15/09 at 12:46 PM.
|
|
|
|
|
|
07/15/09, 1:19 PM
|
#71
|
|
Don Flamenco
Dwarf Warrior
Eredar (EU)
|
$header must be an ARRAY or an OBJECT.
That's why I used
if ($lang == 'de')
$header[] = 'Accept-Language: de-de';
elseif ($lang == 'en')
$header[] = 'Accept-Language: en-gb';
elseif ($lang == 'us')
$header[] = 'Accept-Language: en-us';
Maybe your PHP doesn't understand "$header[]". You could try
$header = array();
$header[0] = ...;
instead.
Since your CURL is wrong the response fails thus no data is found. You should do a count() to check if the object is filled or not. I am just showing the basic techniques on how to get the data.
|
|
|
|
|
07/15/09, 1:21 PM
|
#72
|
|
Glass Joe
Tauren Druid
Frostmane (EU)
|
Ok
Thanks for the response. I will ammend my code and post the outcome here for others to pick up on should their server react like mine.
-SentriX
|
|
|
|
|
|
07/15/09, 2:44 PM
|
#73
|
|
Glass Joe
|
i think i wrote a script today that got either got me blacklisted or crashed the armory. the armory is still up, so i'm guessing its the former.
anyone know how long these blacklists last, and any way of making a script with a lot of curls more blizzard friendly?
|
|
|
|
|
|
07/15/09, 5:35 PM
|
#74
|
|
Glass Joe
Tauren Druid
Frostmane (EU)
|
Originally Posted by bloodrune
i think i wrote a script today that got either got me blacklisted or crashed the armory. the armory is still up, so i'm guessing its the former.
anyone know how long these blacklists last, and any way of making a script with a lot of curls more blizzard friendly?
|
There is no way of knowing how long it lasts but typically try again the next day. You should only need one CURL script and then you can echo out the xml capture in foreach statements. Just be sure to limit the number of queries you make.
|
|
|
|
|
|
07/15/09, 6:54 PM
|
#75
|
|
Glass Joe
|
thats the thing, my script goes through all the gear of a guild's level 80s to give the guild some kind of custom overall grade.
the way i did it was the only way i could think of... by getting the guild roster (1 query), scanning the guild roster for the level 80s (no queries), but the bitch is when i scan each character (n queries) and then need to scan each item to get its item level and whatnot* (~ 20 queries each).
so this number gets rather large for larger guilds, and i only tested it on a small guild (~40 level 80s) once (which worked), then i was blacklisted.
*they really need to start putting the item level in the item info in the character xml
|
|
|
|
|
|
|