DOMDocument::loadHTML error
Header, Nav and Section are elements from HTML5. Because HTML5 developers felt it is too difficult to remember Public and System Identifiers, the DocType declaration is just:
<!DOCTYPE html>
In other words, there is no DTD to check, which will make DOM use the HTML4 Transitional DTD and that doesnt contain those elements, hence the Warnings.
To surpress the Warnings, put
libxml_use_internal_errors(true);
before the call to loadHTML
and
libxml_use_internal_errors(false);
after it.
An alternative would be to use https://github.com/html5lib/html5lib-php.
With a DOMDocument object, you should be able to place an @ before the load method in order to SUPPRESS all WARNINGS.
$dom = new DOMDocument;
@$dom->loadHTML($source);
And carry on.