Is there a PHP class/library that would allow me to query an XHTML document with CSS selectors? I need to scrape some pages for data that is very easily accessible if I could somehow use CSS selectors (jQuery has spoiled me!). Any ideas?
After Googling further (initial results weren't very helpful), it seems there is actually a Zend Framework library for this, along with some others:
XPath is a fairly standard way to access XML (and XHTML) nodes, and provides much more precision than CSS.
Another one:
http://querypath.org/
A great one is a component of symfony 2, CssSelector\ParserIntroduction. It converts CSS selectors into XPath expressions. Take a look =)
Source code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With