PHP DOM not grabbing element
Posted: Tue May 26, 2009 12:56 pm
I'm trying to grab div id's from html with php dom, but it doesn't seem to be working.
Code: Select all
<html>
<head>
<body>
<div id="area">
HELLO
</div>
</body>
</head>
</html>
Code: Select all
<?php
$doc = new DomDocument;
// We need to validate our document before refering to the id
$doc->validateOnParse = true;
$doc->Load('index.html');
echo "The element whose id is books is: " . $doc->getElementById('books') . "\n";
?>