View Single Post
Old 02-19-2009, 08:26 PM   #44 (permalink)
SawGore
The Visitor
 
Join Date: Feb 2009
Posts: 4
Thanks: 0
SawGore is on a distinguished road
Default

Hi,

before all sorry for my poor english (i'm french)

I'm simply do that

PHP Code:
<?php
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 function 
__construct($query$server$guild$guildie$page)
    {
        
$this->query $query;
        
$this->server $server;
        
$this->guild $guild;
        
$this->guildie $guildie;
        
$this->page $page;
    }

    public function 
pull_xml()
    {
        
// change the first part of the $url to the armory link that you need
        
if($this->query === 'roster')
        {
            
$url 'http://eu.wowarmory.com/guild-info.xml?r=' urlencode($this->server) . '&n=' urlencode($this->guild) . '&p=' $this->page;
        }
        elseif(
$this->query === 'character')
        {
            
$url 'http://eu.wowarmory.com/character-sheet.xml?r=' urlencode($this->server) . '&n=' $this->guildie;
        }

        
$ch curl_init();
        
curl_setopt($chCURLOPT_URL$url);
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
curl_setopt($chCURLOPT_CONNECTTIMEOUT15);
        
curl_setopt($chCURLOPT_USERAGENT,  self::BROWSER);
        
        
$url_string curl_exec($ch);
        
curl_close($ch);
        
//return simplexml_load_string($url_string);
        
return $url_string;
    }
}
$armory = new armory('roster''Culte de la Rive noire''Pöst Mörtem'NULLNULL);
$xml $armory->pull_xml();
echo 
$xml;
?>
and the return is

PHP Code:
<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="/layout/error503.xsl"?><page globalSearch="1" lang="en_us">
  <errorhtml/>
<!-- IE 512 byte friendly error override
       ...........................................................
       ...........................................................
       ...........................................................
       ...........................................................
       ...........................................................
       ...........................................................
-->  
</page>
what's wrong ?
SawGore is offline  
Reply With Quote