My code looks like this:

if (!empty($foo))
{
    $doc = new DOMDocument();
    $doc->loadHTML($foo);
    $images = $doc->getElementsByTagName('img');
}

And this is happening:

DOMDocument::loadHTML() [<a href='domdocument.loadhtml'>domdocument.loadhtml</a>]: Document is empty in Entity, line: 2

Re: DOMDocument 80 80

$foo is an empty string or has invalid markup.

See the second comment (by Shane Harter) here.

Re: DOMDocument 80 80

Odd because $foo just finished getting passed through HTML Purifier.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.