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

Recommended Answers

All 2 Replies

$foo is an empty string or has invalid markup.

See the second comment (by Shane Harter) here.

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.