Jump to content

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

Recommended Posts

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

PHP код:


$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;




       $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
Link to comment
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)



Link to comment
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.

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.

  • Create New...