/** * General armory fetch class * Returns XML, HTML or an array of the parsed XML page * * @param int $type * @param string $character * @param string $guild * @param string $realm * @param int $item_id * @param string $fetch_type * @return array */ function fetchArmory($type = false, $character = false, $guild = false, $realm = false, $item_id = false, $fetch_type = 'array') { global $roster; $url = $this->_makeUrl($type, false, $item_id, $character, $realm, $guild); if ($fetch_type == 'html') { $this->setUserAgent('Opera/9.22 (X11; Linux i686; U; en)'); } if ($this->_requestXml($url)) { if ($fetch_type == 'array') { // parse and return array $this->_initXmlParser(); $this->xmlParser->Parse($this->xml); $data = $this->xmlParser->getParsedData(); } elseif ($fetch_type == 'simpleClass') { // parse and return SimpleClass object $this->_initSimpleParser(); $data = $this->simpleParser->parse($this->xml); } else { // unparsed fetches return $this->xml; } return $data; } else { trigger_error('RosterArmory:: Failed to fetch ' . $url); return false; } }