Reading HTML Document
domhtml.php:
<?php
$dom 
= new DomDocument();

$dom->loadHTMLFile("examples/php-net.html");

$xp = new DomXpath($dom);
print 
"--- html head title ---\n";
$res $xp->query("/html/head/title/text()");
print 
$res->item(0)->nodeValue."\n";

print 
"--- get all h1 --- \n";
$res $xp->query("//h1");
foreach(
$res as $h1) {
    print 
$h1->nodeValue ."\n";
}

?>
 
Reading HTML Document © copyright 2004  Bitflux GmbH