Hi everyone, this is driving me nuts.
There is so little info avalible on PHP5 xml features.
Anyway, here is my code and it works with the exception that the divs it grabs only return the content in them. I want the html tags within the div also. Any ideas?
Now I would access the div content like this.
Gives me the div with id date, but not any html within that div.
Thanks
There is so little info avalible on PHP5 xml features. Anyway, here is my code and it works with the exception that the divs it grabs only return the content in them. I want the html tags within the div also. Any ideas?
Code:
$dom = DomDocument::loadHTMLFile($path); // Path to html file
$div = $dom->getElementsByTagName('div');
foreach($div as $node) {
$divId = $node->getAttribute('id');
$divContent = $node->nodeValue;
$dataArray[$divId] = $divContent;
}
Code:
echo $dataArray['date'];
Thanks
Comment