DOMDocument::loadHTML(): warning - htmlParseEntityRef: no name in Entity

This correct answer comes from a comment from @lonesomeday.

My best guess then is that there is an unescaped ampersand (&) somewhere in the HTML. This will make the parser think we're in an entity reference (e.g. ©). When it gets to ;, it thinks the entity is over. It then realises what it has doesn't conform to an entity, so it sends out a warning and returns the content as plain text.


As mentionned here

Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,

you can use :

libxml_use_internal_errors(true);

see http://php.net/manual/en/function.libxml-use-internal-errors.php