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 Responses to “Parse HTML And Traverse DOM In PHP?”

  1. 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

Trackbacks

User contributed tags for this post: