Blog : PHP Simple HTML DOM Parser

PHP Simple HTML DOM Parser

Description, Requirement & Features
   A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way!
   Require PHP 5+.
   Supports invalid HTML.
   Find tags on an HTML page with selectors just like jQuery.
   Extract contents from HTML in a single line.
Download & Documents
   Download latest version form Sourceforge.
   Read Online Document.
Quick Start
•   How to get HTML elements?
•   How to modify HTML elements?
•   Extract contents from HTML
•   Scraping Slashdot!
// Create DOM from URL or file
$html = file_get_html('http://www.google.com/');

// Find all images
foreach($html->find('img') as $element)
  echo $element->src . '
';

// Find all links
foreach($html->find('a') as $element)
  echo $element->href . '
';