Disable warnings when loading non-well-formed HTML by DomDocument (PHP)
Call libxml_use_internal_errors(true); prior to processing with with $xmlDoc->loadHTML() This tells libxml2 not to send errors and warnings through to PHP. Then, to check for errors and handle them yourself, you can consult libxml_get_last_error() and/or libxml_get_errors() when you’re ready: libxml_use_internal_errors(true); $dom->loadHTML($html); $errors = libxml_get_errors(); foreach ($errors as $error) { // handle the errors as you wish … Read more