PHP Classes

CSS Query: Get elements from an HTML page using CSS selectors

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 64%Total: 1,403 All time: 2,777 This week: 161Up
Version License PHP version Categories
cssquery 1.0MIT/X Consortium ...5.0HTML, XML, PHP 5


This class can be used to get elements from an HTML document using CSS selectors similar to Xpath.

It can load an HTML document and perform queries for elements using CSS selectors as query parameters. The search may be applied to the whole document or just to a list of document elements.

The class returns an array of document elements as DOMNode objects that match the query.

Innovation Award
PHP Programming Innovation award nominee
June 2009
Number 2

Prize: One subscription to the PDF edition of the PHP Architect magazine
CSS is a standard that allows you to assign style properties to elements in a page that match a given selector path to match elements by class or identifier.

This class provides a solution to search and extract page elements using the CSS selector path specification.

Manuel Lemos
Picture of Sam S
Name: Sam S <contact>
Classes: 9 packages by
Country: United States United States
Age: 48
All time rank: 34240 in United States United States
Week rank: 231 Up20 in United States United States Up
Innovation award
Innovation award
Nominee: 8x

  Files folder image Files  
File Role Description
Accessible without login Plain text file CSSQuery_test.php Example An example of many selector uses
Accessible without login Plain text file CSSQuery.php Class The class file

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:2,777
This week:161Up
User Ratings User Comments (1)
 All time
very interesting to parse the DOM
13 years ago (Roberto Aleman)