DOMDocument in php

前端 未结 2 1686
再見小時候
再見小時候 2020-11-22 12:16

I have just started reading documentation and examples about DOM, in order to crawl and parse the document.

For example I have part of document shown below:

2条回答
  •  耶瑟儿~
    2020-11-22 12:53

    To create a parser you can use htmlDOM.

    It is very simple easy to use DOM parser written in php. By using it you can easily fetch the contents of div tag.

    For example, find all div tags which have attribute id with a value of text.

    $ret = $html->find('div[id=text]');
    

提交回复
热议问题