Pulling World of Warcraft Armory data with Coldfusion

I help run my World of Warcraft guild site for my guild Redeemed. Recently I have added several pages that pull data from the newly available World of Warcraft Armory site. The Armory lists information about guilds including detailed character sheets. Over the next couple entries, I plan to show how to make use of some of that data with Coldfusion. This article will focus on where the data resides.

Previously I had used Allakhazam as our data source for the roster but had always found it lacking in accurate data as it was dependent on our guildies updating their own profiles. And with all the keyloggers trying to capture accounts, alot of our members were understandably hesitant to use it. So when the Armory came out I dug into the pages to see how it worked and was pleased to find that all pages are XML based. Browsing to a page in the Armory you will get a page like:

http://armory.worldofwarcraft.com/#character-sheet.xml?r=Stonemaul&n=Sandric

Upon viewing the source, you will notice not much is there:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/layout/pageIndex.xsl"?>

<page globalSearch="1" lang="en_us" requestUrl="/index.xml" type="front">
<pageIndex>
<related-info/>
</pageIndex>
</page>

But taking that same URL and getting rid of the # sign:

http://armory.worldofwarcraft.com/#character-sheet.xml?r=Stonemaul&n=Sandric

reveals the data behind the page:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/layout/character-sheet.xsl"?>

<page globalSearch="1" lang="en_us" requestUrl="/character-sheet.xml">
<characterInfo>
<character battleGroup="Cyclone" charUrl="r=Stonemaul&amp;n=Sandric" class="Paladin" .../>
<characterTab>
<talentSpec treeOne="0" treeThree="12" treeTwo="49"/>
<buffs>...

I started by building a couple of simple tables to hold the guild data and some player stats that I wanted for our pages. With the database created, I created a Coldfusion page to bring down the data and noticed something right away when I ran the following line:

The Armory server gave me a down level browser page with all the XML rendered as standard HTML. Having prior experience with a smart web page giving me a down level page instead of XML, I quickly appended the USERAGENT attribute giving it my Firefox useragent info:

<cfhttp url="http://armory.worldofwarcraft.com/guild-info.xml?r=Stonemaul&n=Redeemed" useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2"></cfhttp>

Now all that was left was to pass the XML to be parsed so I could start using it to insert data into my database.

Comments
Marcus Andersson's Gravatar Excellent information!
Since I live in Sweden I have to browse the European armory, but it's just matter of editing the URL:
"http://armory.wow-europe.com/..."; instead of "http://armory.worldofwarcraft.com/...";
# Posted By Marcus Andersson | 5/5/07 5:43 PM
Matt Shooks's Gravatar Thanks for the info Marcus. I did a quick search and could only find a Korean armory site for the other location specific WoW sites - http://armory.worldofwarcraft.co.kr
# Posted By Matt Shooks | 5/6/07 5:51 AM
CuriousGeorge's Gravatar I was just wondering, do you have an email address I could contact you at? I have a couple of questions regarding this blog post.
# Posted By CuriousGeorge | 6/13/07 5:24 PM
Matt Shooks's Gravatar Yes, shooksm at hotmail.
# Posted By Matt Shooks | 6/14/07 4:39 AM
maic's Gravatar Hey there!

I've been able to successfuly pull any data from the armory through the xml files in my local testings, BUT now I'm having problems beacuse when I upload it to a server, I have to use a proxy to been able to access it, and I've found that through it, the xml petitions return the xml file already rendered as HTML (as you stated).

I'm not using firefox, I'm using IE7, so how should I make it to been able to get the xml data instead the rendered html data?

Thank you SO much for your help
# Posted By maic | 7/16/07 8:00 AM
Matt Shooks's Gravatar @maic

Your code that gets the XML from the Armory has to do it using a user agent of a modern browser. Otherwise the armory will assume the browser accessing the page is a downlevel browser and return the XML as rendered HTML instead. Most HTTP objects have a way of setting the user agent directly, just need to check the documentation on how to do it.
# Posted By Matt Shooks | 7/22/07 9:15 PM
Al's Gravatar Have you found a way to use cfhttp to login to the armory and allow coldfusion to parse the guild bank and guild log xml docs.

I am pretty proficient in Coldfusion but have never attempted to simulate an authenticated session before. Basically I just want to be able to display my Guild Bank and Guild Log data on my Coldfusion hosted guild site.
# Posted By Al | 4/19/08 3:03 AM
Al's Gravatar Sweet, thanks alot for giving it a try. My guildies will be quite impressed if I can add bank data to the site as well as everything else. I really wish I could figure it out, but every attempt I've made has given me errors and I just don't have the time to mess around with it right now.

I'm looking forward to seeing your results!!

Thanks again.
# Posted By Al | 4/20/08 6:05 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.001. Contact Blog Owner