Нужно к себе спарсить информацию о тендерах http://zakupki.gov.ru/epz/order/quicksearch/search.html
Пробую реализовать через simple_html_dom
. Их новости получилось спарсить, информацию о тендерах — нет.
require_once 'simple_html_dom.php'; // библиотека для парсинга
// $username = 'durov'; // Имя в twitter
$maxpost = '5'; // к-во постов
$html = file_get_html('http://zakupki.gov.ru/epz/order/quicksearch/search.html');
$i = '0';
foreach ($html->find('div.registerBox') as $article) { //выбираем все li сообщений
$item['text'] = $article->find('div.reportBox', 0)->innertext; // парсим текст сообщения в html формате
$item['time'] = $article->find('ul', 0)->innertext; // парсим время в html формате
$articles[] = $item; // пишем в массив
$i++;
if ($i == $maxpost) break; // прерывание цикла
}
for ($j = 0; $j < $maxpost; $j++) {
echo '<div class="twitter_message">';
echo '<p class="twitter_text">' . $articles[$j]['text'] . '</p>';
echo '<p class="twitter_time">' . $articles[$j]['time'] . '</p>';
echo '</div>';
}
Ошибки:
Warning: file_get_contents(http://zakupki.gov.ru/epz/order/quicksearch/search.html) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\Program Files\VertrigoServ\www\simple_html_dom.php on line 31
Fatal error: Call to a member function find() on a non-object in C:\Program Files\VertrigoServ\www\pars.php on line 9
Подскажите, как быть.
simple_html_dom.php
точно находится в той же папке что и файлpars.php
?warning
сообщений? Возможно парсер не может просто загрузить страницу и выдает что-то типа ` failed to open stream: HTTP request failed` а вы этого не наблюдаете.. в результате и остальное обламываетсяHTTP/1.1 404 Not Found
он не получил страницу по указанному URL