How to parse HTML correctly with DOMDocument?
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].
精彩评论