Files
archived-presentations/slides/php5xml2/dom_html.php
2005-05-16 23:53:57 +00:00

11 lines
314 B
PHP

<?php
$dom = new DomDocument();
/* load HTML document (if it is not valid) */
@$dom->loadHTMLFile("http://" . $_SERVER['SERVER_ADDR'] .
dirname($_SERVER['PHP_SELF']) . '/1');
$xp = new DomXpath($dom);
/* use XPath to get the title of the */
$res = $xp->query("//title/text()");
echo $res->item(0)->nodeValue;
?>