[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Парсер, ошибка
DanLogic
Добрый день.
Написал вот такое вот.
С главной страницы сайта парсит нормально.
С остальных отдает ошибку 404.
Подскажите пожалуйста, как ее обойти?

<?php
include_once('simple_html_dom.php');
function curl_get($url, $referer = 'https://autoenergy.by/'){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0");
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}

//подключене страницы


$html = curl_get("https://autoenergy.by/catalog/gruzovye/");

$dom = str_get_html($html);
$courses = $dom->find('.product-item-col');
echo $courses->plaintext .'</br>';


foreach ($courses as $course){
$a = $course->find('a', 0);

$one = curl_get("https://autoenergy.by/gruzovye/" . $a->href);
$one_dom = str_get_html($one);
//название
$name = $one_dom->find('.navigation-title',0);
echo $name->plaintext .'</br>';

//цена
$price = $one_dom->find('.product-item-detail-tab-content',0);
echo $price->plaintext .'</br>';





}




Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.