How to parse from the site Zagalovok, Picture, content?

Is the plague better to use which is the fastest? ...

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer by the participants Dmitriy Simushev , user194374, D-side , zRrr , Ipatiev Jun 20 '16 at 15:09 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

    2 answers 2

    I personally used the PHP Simple HTML DOM Parser library. Pretty powerful tool.

    A built-in DomDocument PHP library may be appropriate, but you must keep in mind that it will treat HTML as XML.

    As a speed PHP Simple HTML DOM Parser eats a lot of memory, especially if the code is too cumbersome, but it is much cooler in terms of functionality and quality of parsing than a DomDocument. DomDocument can be used to parse those HTML documents that contain few errors or exceptions from XML.

    I remember the partners were too lazy to make an RSS feed for exchange rates, because of this I had to parse the html page, because the courses were updated every hour. I throw the link to the tool that I used to solve the problem.

    http://simplehtmldom.sourceforge.net/

    <?php include('simple_html_dom.php'); $html = file_get_html('http://google.kz'); foreach($html->find('что тебе надо найти') as $e){ $arr[] = trim($e->innertext); //можно не массивом } print_r($arr); //пример вывода массива ?> 
    • Karma is not enough to write comments to others. Add @ before the parsa function, it will help to ignore errors on the html-page. On the installation account, there is only 1 php page, it needs to be copied to the site folder, and then added first by include('simple_html_dom.php') . Further documentation. - OnlyNoiseOnWires
    • file_get_html (' google.com/' ); There is no example of such a function. File_get_contents - Sauron
    • Paste the file simple_html_dom.php into the same directory as index.php. An example I will put in the answer. - OnlyNoiseOnWires
    • @Sauron she is in simple_html_dom.php - Naumov