My plan is to get the name, url, and rank of the characters from WoW Armories guild listing and put it into a small database table. With that information, I will then be able to go to each WoW Armory character sheet for each character and get the rest of the information and drop that into a table.
Once the tables have been populated for the first time I will need to verify against the WoW Armory XML guild list to first get char name and url.
- If name isn't there it needs to add it from the table
- If name is there it needs to update it from the table
- If name is not there it needs to delete it from the table.
Once I can get this script working I will have to look at turning all this into a Drupal module but first things first.
As, right now my table is blank, and needs to be populated by the info for the first time.
I am at the first step which is just getting the basic char name, rank and url from WoW Amories guild listing. You can get the URL by checking the wowarmory website, and searching for the guild Royalties of Horde on the Borean Tundra.
Here is the code below:
Code: Select all
<?php
// Connect to the MySQL database
$conn = mysql_connect("localhost", "root", "mywire21");
// Select the database
$db = mysql_select_db("royalities");
// Desired address
$url = " URL TO GUILD LISTING HERE";
// Retrieve the URL contents
$page = file_get_contents($url);
echo "getting url contents";
// Parse the returned XML file
$xml = new SimpleXMLElement($page);
echo "parse xml file";
echo $xml->guildKey->guildInfo->guild->members->character . "<br />";
foreach($xml->guildKey->guildInfo->guild->members->character() as $character)
{
echo $character['name'] . "<br />";
echo $character['url'] . "<br />";
echo $character['rank'] . "<br />";
$InsertQuery = "INSERT INTO roster (name, url, rank) VALUES ('$character[name]', '$character[url]', '$character[rank]')";
echo "insert query $InsertQuery<p>";
}
?>
Any thoughts on why I am getting the hundreds of errors? o.O