Parse HTML with PHP's HTML DOMDocument
Posted
by Mint
on Stack Overflow
See other posts from Stack Overflow
or by Mint
Published on 2010-04-03T12:23:59Z
Indexed on
2010/04/03
12:33 UTC
Read the original article
Hit count: 698
I was trying to do it with "getElementsByTagName", but it wasn't working, I'm new to using DOMDocument to parse HTML, as I used to use regex until yesterday some kind fokes here told me that DOMEDocument would be better for the job, so I'm giving it a try :)
I google around for a while looking for some explains but didn't find anything that helped (not with the class anyway)
So I want to capture "Capture this text 1" and "Capture this text 2" and so on.
Doesn't look to hard, but I can't figure it out :(
<div class="main">
<div class="text">
Capture this text 1
</div>
</div>
<div class="main">
<div class="text">
Capture this text 2
</div>
</div>
© Stack Overflow or respective owner