Parsing pages:
1) http://wotreplays.ru/site/12068516?secret=96148d68d7220e8637d87133d47b2114#stats
2) http://wotreplays.ru/site/12068516?secret=96148d68d7220e8637d87133d47b2114#teams combat statistics (replay) Wold of Tanks.
When you load the second link in the browser via the command line #teams, the required tab opens (Command result) - everything is fine here.
When parsing with the curl library with the url parameter: http://wotreplays.ru/site/12068516?secret=96148d68d7220e8637d87133d47b2114#teams
returns the html page code http://wotreplays.ru/site/12068516?secret=96148d68d7220e8637d87133d47b2114#stats .
The url is the same, the difference in the end of #stats, #teams default is #stats.
I see that the ng-hide, ng-show directives are used to set the visibility of the block (by clicking on the "Command Result" tab). Perhaps this handles all Angular (JS-script can not find).
function curl_get($url, $referer = 'http;//www.google.com'){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); // Не считывать заголовки curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; ry:38.0) Gecko/20100101 Fifefox/38.0"); // указаваем браузер откуда пришел запрос curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Переходить по редиректам (чаще всего ставится) curl_setopt($ch, CURLOPT_REFERER, $referer); // Содержимое заголовка от куда был сделан запрос ('http;//www.google.com). curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Ответ сервера сохранять в переменную, а не на экран // curl_setopt($curl, CURLOPT_COOKIEFILE, $cookieFullP); // Запись кук в файл // curl_setopt($curl, CURLOPT_COOKIEJAR, ScookieFullP); // Получение кук из файла, не работает без записи кук в файл // curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'); //Отправка куки (Содержимое заголовка «User-Agent:» для использования в HTTP-запросе.) // curl_setopt($curl, CURLOPT_COOKIE, $cookie); // отправляем куки // curl_setopt($curl, CURLOPT_POSTFIELDS, $post); // POST запрос (для заполнения форм) 'name=Дима&surname=Трепачев' или ['name'=>' Дима', 'surname'=>'Трепачев'] // curl_setopt($curl, CURLOPT_PROXY, $proxy); // ПРОКСИ (изменение IP адресов, для обхода возможной защиты сайта) // curl_setopt($curl, CURLOPT__INTERFACE, $ip); // ПРОКСИ - если на сервере не настоящие прокси, представляемся $data = curl_exec($ch); curl_close($ch);
return $ data; }
$url = curl_get('http://wotreplays.ru/site/12068516?secret=96148d68d7220e8637d87133d47b2114#teams'); $TextPage = curl_get($url); print_r($TextPage);
Question: what and how to do to parse the second page with the #teams parameter (Team Result).