$html = file_get_contents("http://www.somesite.com/"); $dom = new DOMDocument(); $dom->loadHTML($html); echo $dom;
THROWS
Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ‘;‘ in Entity, Catchable fatal error: Object of class DOMDocument could not be converted to string in test.php on line 10
(1) calling htmlentities()
or similar on the string will fix the problem.
(2)To evaporate the warning, you can use libxml_use_internal_errors(true)
PHP Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,
时间: 2024-10-19 11:33:38