Three files are needed.
- A basic PHP file that does the structure and includes links that will call your AJAX function guild_data.php - rothui - Google Code
Remember: If you do not support the Request with a browser information the response will be HTML and not XML always. So if you want an XML response add some kind of user agent information. But sometimes HTML is wanted, tooltips for example.
Oh btw...Don't spam the armory server with requests or you will find yourself banned temporarily shortly after.
Thanks for this. I had originally intended to do some playing with data from the Armory but PHP (and web development in general) is not something I have much experience with so I never got sufficiently motivated to do it. I think this will give me the impetus to have another go as it means I don't need to spend ages working out how to get the data and concentrate on the manipulation of it.
Not actually a member of Refusion on Burning Blade.
Like in you can't connect or you just get a blank page? If it's the latter you need to look at the source of the page: View->Source code or something like that.
http://phparmory.sourceforge.net/ or http://sourceforge.net/projects/phparmory/ is a parse I found around the net that puts everything into php arrays. It's pretty neat and easy to add in your own code (if you know a bit of PHP). I added in some code to get Arena Teams for use on my guilds under dev new layout and it works nice.
I use cURL to pull down the xml and simplexml to parse it for my guilds roster page. Requires PHP5, which most webhosts haven't switched to (including our host). I run the script below on my desktop that has PHP5, it parses the info I need and puts it into a mysql database at our host. Then on our hosts server with PHP4, roster.php parses the data from the mysql database.
#!/usr/bin/php
<?php
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()
I was mucking around testing with Firefox, IE7 and Safari for Windows today and I happened to notice Safari is awesome for using the armory (mostly). Firefox and IE7 will choke/lock up on the large xmlhttprequests and not respond until they have finished loading/processing the page. Safari however will let you carry on no problems, opening new tabs etc while the armory is loading in the background tab.
It's a pain Safari doesn't render text white in input boxes though
The universe is run by the complex interweaving of three elements. Energy, matter, and enlightened self-interest.
Like in you can't connect or you just get a blank page? If it's the latter you need to look at the source of the page: View->Source code or something like that.
Huh, yeah.
Weird, normally Firefox displays the XML data and doesn't just put out a blank page.
EDIT: I attached the source to my armory parse. It's pretty ugly and completely devoid of comments since it's something I hacked up in an afternoon and never really bothered with again. Hopefully someone can get some value out of the source however.
I just want to give you an update on this to show what amazing stuff can be done.
I built our own item search based on the Armory XML, take a look
All data is generated in real time, no database is used.
p.s. I couldn't use the phparmory XML parser, sadly it had a bug with XML attributes. But i found another one that worked properly and nearly the same.
p.s. I couldn't use the phparmory XML parser, sadly it had a bug with XML attributes. But i found another one that worked properly and nearly the same.
What did you end up using? I was starting to use phpArmory, but if it's bugged, I should either look at fixing it or just change to something else.
You can remove some code (which is only used for some special functions of his scripts) and edit it to fit your needs, but I found it to be perfect to build some websites quickly.
I'm using some lines of it in the script which generates our memberlist (http://pernoctem.de/members.php) twice a day automatically via cron jobs.
I use cURL to pull down the xml and simplexml to parse it for my guilds roster page. Requires PHP5, which most webhosts haven't switched to (including our host). I run the script below on my desktop that has PHP5, it parses the info I need and puts it into a mysql database at our host. Then on our hosts server with PHP4, roster.php parses the data from the mysql database.
#!/usr/bin/php
<?php
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()
Can you help me ? I think this function is not valid right ?
You will need libcurl for this and you will also need to compile PHP with the --with-curl=X directive, where X is the location of libcurl's libraries and includes.
I'm using Google AppEngine for my Armory-crawling site. If anyone else is using it, AppEngine's URL fetching ability doesn't let one set the User-agent so only the HTML responses are available. If anyone knows a workaround I'd love to hear it.
Here's my tool, Gear Wishlist that generates a list of potential gear upgrades. It doesn't support power-user tweaking, but it a simple way to eyeball what's out there.
I'm using Google AppEngine for my Armory-crawling site. If anyone else is using it, AppEngine's URL fetching ability doesn't let one set the User-agent so only the HTML responses are available. If anyone knows a workaround I'd love to hear it.
Here's my tool, Gear Wishlist that generates a list of potential gear upgrades. It doesn't support power-user tweaking, but it a simple way to eyeball what's out there.
This isn't really a great thread for it, but it would be cool to get source code for it when you have something working.
Also, right now "Silver Hand" doesn't seem to work at all (says "Error: Server Error"), but "Silver+Hand" pops up asking me if I want Feral DPS or Tanking, and a couple times it has shown my current gear beyond the popup asking for which feral spec I am. After clicking a spec it then continues to "Error: Server Error"
This isn't really a great thread for it, but it would be cool to get source code for it when you have something working.
Also, right now "Silver Hand" doesn't seem to work at all (says "Error: Server Error"), but "Silver+Hand" pops up asking me if I want Feral DPS or Tanking, and a couple times it has shown my current gear beyond the popup asking for which feral spec I am. After clicking a spec it then continues to "Error: Server Error"
Interesting, I hadn't tested with realm names containing spaces. I'll look into it, thanks for the heads-up!
(The server logs show a lot of errors trying to fetch character sheets from the armory.)
EDIT: I made a trivial change to replace spaces with '+' for the armory url generation and it seems to be working for you now.
You have to throttle your requests. If you exceed 45 requests in like a minute (or one per 1.5 seconds over a sustained period) you'll start pulling 503's. If you keep hammering after you're pulling 503's then it'll ban you for a day or so. It only lasts for a day or so, but it's your warning.