Parse HTML And Traverse DOM In PHP?
I love how easily I can traverse an HTML document with jQuery, and I’d love to be able to do it in PHP. There are a few classes, but the PHP binding for Tidy seems to be where it’s at. The Zend dev pages make it look that way, anyway.
3 Comments
Comments RSS TrackBack Identifier URI
Leave a comment
[...] MaisonBisson.com A bunch of stuff I would have emailed you about. « Parse HTML And Traverse DOM In PHP? [...]
Surely a nice way to cope with not strictly valid HTML Code. But: how would you do the traversing? Tidy does not offer very comfortable functions for navigating inside an HTMLs DOM.
An example: jQuery offers possibilities such as “find all elements of class xy and change their first child’s background colour to yellow”. How could anything like this be performed in PHP?
Cheers, Rude
Try
“PHP Simple HTML DOM Parser”
at
http://sourceforge.net/projects/simplehtmldom/