A
A
Anna Av2015-10-27 02:16:10
Parsing
Anna Av, 2015-10-27 02:16:10

Parsing of Yandex dictionaries. Need to load information about a word into a table?

The first time I encounter help the student, the teacher does not explain how to do it
Task
• Display the data received from the specified resource in the form of a table
• The script should work for any similar page
• Be able to modify the work of the parser in time to protect the work.
Page example
https://slovari.yandex.ru/
%D1%81%D0%BB%D0%BE
%D0%BD/%D0%BF
%D1%80%D0%B0%D0%B2%D0
%BE% D0%BF
%D0%B8%D1%81%D0%B0%D0
%BD%D0%B8%D0%B5/
Retrieve
Load word information

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anna Av, 2015-11-09
@DORWEI

<?php
/*
Парсер 
*/
$start = microtime(true);

set_include_path(get_include_path().PATH_SEPARATOR.'library/');
set_include_path(get_include_path().PATH_SEPARATOR.'phpQuery/');

require('config.php');

function __autoload( $className ) {require_once( "$className.php" );}

echo "<br>".date('H:i:s').URL;

/* Если атворизация не нужна */
$pageText =new Curl();
/* Подключили документ объект */
$page=$pageText->get_page(URL);
/* URL адрес сайта который будем парсить */

/* Метод phpQuery получаем документ страницу (find)*/
$cat_page = phpQuery::newDocument($page);

/* выводим документы и получаем конкретные элементы, обходим элементы страницы */
$paginator = $cat_page->find('td.b-layout-table__cell' );
print($paginator);

//////////////////////////////////////////////////////////////////////////
$time = microtime(true) - $start;
printf("<br>".date('H:i:s').' %.4F ', $time);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question