now getting data from the armory, almost all of it, no more error.
but, the root of the problem is that it is incorrectly accessing the parsed XML data. I commented out the problem lines and its "working" now, but the profession name and skill level information will not be present. I tried fetching the XML data my self so I could see where the problem was and fix the fetch, but any way I try to fetch the XML data it comes back as a HTML page instead of an XML blob, so I'm not sure what other special stuff it is doing to fetch the raw data instead of the pretty html version.
Maybe another mind can fix this part and we will be good to go?
Code:
<?php
// ########################################################################
//
// gWoWEvents, Copyright ? 2006, Ryan Snook (www.gryphonllc.com )
//
// If you have fixes, improvements or other additions to make to
// gWoWEvents, please contact me at rsnook@gmail.com for collaboration.
// I appreciate your kind consideration.
//
// This work is licensed under the Creative Commons
// Attribution-Noncommercial-No Derivative Works 3.0 United States License.
// To view a copy of this license, visit
// http://creativecommons.org/licenses/by-nc-nd/3.0/us/ or send a letter to
// Creative Commons, 171 Second Street, Suite 300,
// San Francisco, California, 94105, USA.
//
// ########################### SVN info ###################################
// $Id: cron.gwowevents.charinfo.php 830 2008-01-23 20:18:51Z gryphon $
// $Rev: 830 $
// $LastChangedBy: gryphon $
// $Date: 2008-01-23 12:18:51 -0800 (Wed, 23 Jan 2008) $
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
// ########################## REQUIRE BACK-END ############################
require_once('./includes/functions_gwowevents.php');
$res = $vbulletin->db->query("SELECT * FROM " . TABLE_PREFIX . "gwowevents WHERE `armorydata` != '1' ORDER BY `armorydata` ASC");
while ($char = $vbulletin->db->fetch_array($res))
{
require_once('./includes/class_gwowarmory.php');
$x = new gWoWArmory;
$x->SetLocale($char['locale']);
$x->SetRealmName($char['realm']);
$x->SetCharName($char['character']);
sleep(10);
$character = $x->FetchCharacterSheet();
sleep(10);
$character_skills = $x->FetchCharacterSkills();
if ($character != false)
{
/*
if ($character['characterInfo']['characterTab']['professions']['skill']['0'])
{
$character['prof1'] = $character['characterInfo']['characterTab']['professions']['skill']['0']['name'];
$character['skill1'] = $character['characterInfo']['characterTab']['professions']['skill']['0']['value']['0'];
}
else
{
$character['prof1'] = $character['characterInfo']['characterTab']['professions']['skill']['name'];
$character['skill1'] = $character['characterInfo']['characterTab']['professions']['skill']['value']['0'];
}
*/
/*
$secondaryskill = array();
foreach($character_skills['characterInfo']['skillTab']['skillCategory']['1']['skill'] as $skill)
{
$secondaryskill[$skill['key']] = $skill['value']['0'];
}
*/
$charinfo_query = "
`charurl` = '" . $character['characterInfo']['character']['charUrl'] . "',
`level` = '" . $character['characterInfo']['character']['level'] . "',
`title` = '" . $character['characterInfo']['character']['title'] . "',
`faction` = '" . $character['characterInfo']['character']['faction'] . "',
`factionid` = '" . $character['characterInfo']['character']['factionId'] . "',
`gender` = '" . $character['characterInfo']['character']['gender'] . "',
`genderid` = '" . $character['characterInfo']['character']['genderId'] . "',
`race` = '" . $character['characterInfo']['character']['race'] . "',
`raceid` = '" . $character['characterInfo']['character']['raceId'] . "',
`class` = '" . $character['characterInfo']['character']['class'] . "',
`classid` = '" . $character['characterInfo']['character']['classId'] . "',
`talentspec` = '" . $character['characterInfo']['characterTab']['talentSpec']['treeOne'] . "," . $character['characterInfo']['characterTab']['talentSpec']['treeTwo'] . "," . $character['characterInfo']['characterTab']['talentSpec']['treeThree'] . "',
`talent1` = '" . $character['characterInfo']['characterTab']['talentSpec']['treeOne'] . "',
`talent2` = '" . $character['characterInfo']['characterTab']['talentSpec']['treeTwo'] . "',
`talent3` = '" . $character['characterInfo']['characterTab']['talentSpec']['treeThree'] . "',
`guild` = '" . $character['characterInfo']['character']['guildName'] . "',
`guildurl` = '" . $character['characterInfo']['character']['guildUrl'] . "',
`hp` = '" . $character['characterInfo']['characterTab']['characterBars']['health']['effective'] . "',
`mp` = '" . $character['characterInfo']['characterTab']['characterBars']['secondBar']['effective'] . "',
`str` = '" . $character['characterInfo']['characterTab']['baseStats']['strength']['effective'] . "',
`agi` = '" . $character['characterInfo']['characterTab']['baseStats']['agility']['effective'] . "',
`sta` = '" . $character['characterInfo']['characterTab']['baseStats']['stamina']['effective'] . "',
`int` = '" . $character['characterInfo']['characterTab']['baseStats']['intellect']['effective'] . "',
`spi` = '" . $character['characterInfo']['characterTab']['baseStats']['spirit']['effective'] . "',
`arm` = '" . $character['characterInfo']['characterTab']['baseStats']['armor']['effective'] . "',
`strbase` = '" . $character['characterInfo']['characterTab']['baseStats']['strength']['base'] . "',
`agibase` = '" . $character['characterInfo']['characterTab']['baseStats']['agility']['base'] . "',
`stabase` = '" . $character['characterInfo']['characterTab']['baseStats']['stamina']['base'] . "',
`intbase` = '" . $character['characterInfo']['characterTab']['baseStats']['intellect']['base'] . "',
`spibase` = '" . $character['characterInfo']['characterTab']['baseStats']['spirit']['base'] . "',
`armbase` = '" . $character['characterInfo']['characterTab']['baseStats']['armor']['base'] . "',
`prof1` = '" . $character['prof1'] . "',
`skill1` = '" . $character['skill1'] . "',
"
/* There seems to be something wrong with the $character structure that is supposed to
* fill in all of this info */
. "`prof2` = '" . $character['prof2']. "',"
. "`skill2` = '" . $character['skill2']. "',"
/*
. "`prof2` = '" . $character['characterInfo']['characterTab']['professions']['skill']['1']['name'] . "',"
. "`skill2` = '" . $character['characterInfo']['characterTab']['professions']['skill']['1']['value']['0'] . "',"
*/
."
`cooking` = '" . $secondaryskill['cooking'] . "',
`firstaid` = '" . $secondaryskill['firstaid'] . "',
`fishing` = '" . $secondaryskill['fishing'] . "',
`riding` = '" .$secondaryskill['riding'] . "',
";
$char['realmchar'] = addslashes($char['realm'] . "." . $char['character']);
if ($character['characterInfo'] && $character['characterInfo']['characterTab']['characterBars']['health']['effective'])
{
$vbulletin->db->query("UPDATE " . TABLE_PREFIX . "gwowevents SET " . $charinfo_query . " `armorydata` = '1' WHERE `realmchar` = '" . $char['realmchar'] . "'");
}
else
{
$vbulletin->db->query("UPDATE " . TABLE_PREFIX . "gwowevents SET `armorydata` = '2' WHERE `realmchar` = '" . $char['realmchar'] . "'");
}
}
if (VB_AREA == 'AdminCP')
{
echo $char['character'] . '<pre>';
print_r($character);
print_r($character_skills);
echo '<pre><hr />';
}
$char_updated .= $char['character'] . ", ";
}
echo $char_updated;
?>