Suppose you have the following HTML:
You want to load it into a
Try this:
$doc = new DOMDocument; $doc->recover = true; $doc->loadXml($response);
The $doc->recover = true tells DOMDocument to try and parse non-well formed documents. See the documentation for more information.
$doc->recover = true