Jump to content
Sign in to follow this  
Shooshpanius

Как теперь парсить армори?

Recommended Posts

раньше все решалось по типу:

PHP код:

$url='http://www.wowarmory.com/guild-info.xml?r=Рилм&gn=Гильдия';

$xml = simplexml_load_file($url);

теперь же по данному типу урла получаем 503... замена на новый урл типа

http://eu.battle.net/wow/ru/guild/Рилм/Гильдия/  тоже не дает результатов :(

По чарам та же песня, код :

  class char_data  

  {

  

    public function get_xml($url,$lang)  

    {

      $ch = curl_init();

      if ($lang == 'de')

        $header[] = 'Accept-Language: de-de';

      elseif ($lang == 'en')

        $header[] = 'Accept-Language: en-gb';

      elseif ($lang == 'us')

        $header[] = 'Accept-Language: en-us';      

    elseif ($lang == 'ru')

        $header[] = 'Accept-Language: ru-ru';

      $browser = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';

      curl_setopt ($ch, CURLOPT_URL, $url);

      curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);  

      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

      curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);

      curl_setopt ($ch, CURLOPT_USERAGENT, $browser);

      $url_string = curl_exec($ch);

      return simplexml_load_string($url_string);

      return $url_string;

      curl_close($ch);

    }

  };

       $lang = 'ru'; 

        $url = "http://eu.battle.net/wow/ru/character/вечная-песня/".$guild_char."/advanced";      

        $char_data = new char_data(); 

        $xml_char_data = $char_data->get_xml($url,$lang);

на $xml_char_data->characterInfo->character['race']  и $xml_char_data->characterInfo->character['class'] выдает пустоту... :(

Edited by Shooshpanius

Share this post


Link to post
Share on other sites

ну вобщем отпарсить получилось... пример кода:

$armory_url = 'http://eu.battle.net/wow/ru/guild/Рилм/Гильдия/roster';

$guild_data = new guild_data();

$xml_guild_data = $guild_data->get_xml($armory_url,$lang);

foreach($xml_guild_data->body->div->div[1]->div->div[1]->div->div[1]->div[1]->div[1]->table->tbody->tr as $gdata)

{

}

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...