I have the following code
function DOMinnerHTML($element)
{
$innerHTML="";
$children=$element->childNodes;
foreach($children as $child)
{
$tmp_dom=new DOMDocument();
$tmp_dom->appendChild($tmp_dom->importNode($child,true));
$innerHTML.=trim($tmp_dom->saveHTML());
}
return $innerHTML;
}
$doc=new DOMDocument();
$doc->loadHtmlFile('http://www.google.com/');
$links=$doc->getElementsByTagName('a');
foreach($links as $m)
{
echo DOMinnerHTML($links[$m]).'<br />';
}
And it outputs nothing.
How can I do so that it outputs the content of each link in all http://google.com ?
it seems this:
should be just this: