As many have and are still trying to do, I’m trying to read from the warcraft armory pages for character data.
I can actually get a response from them, but unfortunately, its far from being xml. I’ve looked into why I’m not getting XML from the character URL which is an XML document via View Source, which shows XML fine, however it appears that the internal user agent that flash uses for when requests are made through URLLoader dont have a user agent.
The armory pages see that no user agent was sent and transform the document using xslt into xhtml. How do I prevent this so that I can simply say, “Hey, I’m a browser that understands xml, send me the xml not the html”?
Here is the code I have so far that returns the URLLoader data…
var xmlFile:String = "http://www.wowarmory.com/character-sheet.xml?r=" + wowServer + "&n=" + wowCharacter;
var loadit:URLLoader = new URLLoader();
loadit.dataFormat = URLLoaderDataFormat.TEXT;
// loadit.userAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4";
loadit.addEventListener(Event.COMPLETE, completeHandler);
loadit.load(new URLRequest(xmlFile));
function completeHandler(event:Event):void {
txtStatus.text = event.target.data as String;
}