开发者

How to parse HTML correctly with DOMDocument?

Lets say I have this type of HTML website:

stuff
<div id="123">
*HTML开发者_运维问答 CODE I NEED*
</div>
stuff
<div id="234">
*HTML CODE I NEED*
</div>
more stuff

How can I extract HTML CODE I NEED from those div's, given that I know their IDs ?

Thank you!


You can get the nodes with DOMDocument::getElementById [docs] and the text content with the textContent [docs] property.

If you want the inner HTML of the nodes, you can call DOMDocument::saveHTML [docs].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜