how to use dom php parser

前端 未结 4 1593
轻奢々
轻奢々 2020-11-28 13:04

I\'m new to DOM parsing in PHP:
I have a HTML file that I\'m trying to parse. It has a bunch of DIVs like this:

<
4条回答
  •  孤独总比滥情好
    2020-11-28 13:32

    I got this to work using simplehtmldom as a start:

    $html = file_get_html('example.com');
    foreach ($html->find('div[id=interestingbox]') as $result)
    {
        echo $result->innertext;
    }
    

提交回复
热议问题