Hi,
I'm trying to scrape a bunch of HTML documents, and having good success, except for getting the innerHTML / value of textareas.
$html = file_get_contents("whatever.html");
$dom = new DOMDocument();
@$dom->loadHTML($html);
$nodes = $dom->getElementsByTagName('*');
foreach($nodes as $node){
if($node->nodeName == "input" && $node->getAttribute('name') == "fname"){
echo "first_name: " . $node->getAttribute('value') . "<br>\n";
}
}
That is working great. But for a textarea there isn't a value attribute, and innerHTML doesn't work.
How do you get the contents of a textarea using DOMDocument?
Thanks!
Metzen