Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.