Jump to content

XML Problems...


candycrate

Recommended Posts

I developed a crawler for WOW Armory (with CuRL) but i have some problems with it...

Players with weird characters like Xö can not be displayed properly (and saved in database)... Instead the XML returns  XΓΆ as name (instead of )..

 

I think that the problem is caused from CuRL (i doesn't read/return special characters or smth).

 

Here is the code of the CuRL i use:

    $url = 'http://eu.wowarmory.com/character-sheet.xml?r=' . urlencode($this->server) . '&n=' . $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);
    $x = new SimpleXMLElement($url_string);
    return $x;

 

then to fetch the name i use  $x->characterInfo->character['name']

 

Do i have to change a parameter at CuRL or smth??

I use PHP Version 5.2.9

 

thanks for reading this

Link to comment
https://forums.phpfreaks.com/topic/186640-xml-problems/
Share on other sites

This is what i try to read:

http://eu.wowarmory.com/character-sheet.xml?r=Earthen+Ring&n=Xö

 

When i copy/paste the URL above at my PHP Editor changes to:

http://eu.wowarmory.com/character-sheet.xml?r=Earthen+Ring&n=X%C3%B6

 

and this is what i get:

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [battleGroup] => Cyclone / Wirbelsturm
            [charUrl] => r=Earthen+Ring&n=X%C3%B6
            [class] => Warrior
            [classId] => 1
            [classUrl] => c=Warrior
            [faction] => Horde
            [factionId] => 1
            [gender] => Female
            [genderId] => 1
            [guildName] => Tides of Chaos
            [guildUrl] => r=Earthen+Ring&gn=Tides+of+Chaos
            [lastModified] => December 27, 2009
            [level] => 80
            [name] => XΓΆ
            [points] => 2650
            [prefix] => 
            [race] => Orc
            [raceId] => 2
            [realm] => Earthen Ring
            [suffix] => , Champion of the Frozen Wastes
            [titleId] => 97
        )
)

 

 

Link to comment
https://forums.phpfreaks.com/topic/186640-xml-problems/#findComment-985878
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.