class armory {
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 $armoryRegion;
public function __construct ( $query, $server, $guild, $guildie, $page, $funcRegion ) {
$this->query = $query;
$this->server = $server;
$this->guild = $guild;
$this->guildie = $guildie;
$this->page = $page;
$this->region = $funcRegion;
} // end of __construct()
public function pull_xml() {
global $USaurl;
global $EUaurl;
global $currentArmoryRegion;
// change the first part of the $url to the armory link that you need
if( $this->query === 'roster' ){
if ($armoryRegion == 'US'){
$url = 'http://www.wowarmory.com/guild-info.xml?r=' . urlencode($this->server) . '&n=' . urlencode($this->guild) . '&p=' . $this->page;
} else {
$url = 'http://eu.wowarmory.com/guild-info.xml?r=' . urlencode($this->server) . '&n=' . urlencode($this->guild) . '&p=' . $this->page;
}
}elseif( $this->query === 'character' ){
if ($armoryRegion == 'US'){
$url = 'http://www.wowarmory.com/character-sheet.xml?r=' . urlencode($this->server) . '&cn=' . $this->guildie;
} else {
$url = 'http://eu.wowarmory.com/character-sheet.xml?r=' . urlencode($this->server) . '&cn=' . $this->guildie;
}
}elseif( $this->query === 'arena' ){
$currentArmoryRegion = $armoryRegion;
if ($this->region === 'US'){
$url = 'http://www.wowarmory.com/character-arenateams.xml?r=' . urlencode($this->server) . '&cn=' . $this->guildie;
$USaurl = 'http://www.wowarmory.com/character-arenateams.xml?r=' . urlencode($this->server) . '&cn=' . $this->guildie;
} else {
$url = 'http://eu.wowarmory.com/character-arenateams.xml?r=' . urlencode($this->server) . '&cn=' . $this->guildie;
$EUaurl = 'http://eu.wowarmory.com/character-arenateams.xml?r=' . urlencode($this->server) . '&cn=' . $this->guildie;
}
}
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt ($ch, CURLOPT_USERAGENT, self::BROWSER);
$url_string = curl_exec($ch);
curl_close($ch);
return simplexml_load_string($url_string);
} // end of pull_xml()
} // end class
Connect With Us