View Single Post
  #115  
Old 06-28-2008, 01:50 AM
Dsru123 Dsru123 is offline
 
Join Date: Apr 2004
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
?>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01362 seconds
  • Memory Usage 1,811KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete