我想从其他域使用PHP获得<ul>
s innerHTML
。file_get_contents与目标url源代码的警告消息
$mhraWebUygulamasi =file_get_contents('http://www.mhra.gov.uk/Safetyinformation/Safetywarningsalertsandrecalls/index.htm');
$doc = new DOMDocument();
$doc->loadHTML($mhraWebUygulamasi);
$doc->preserveWhiteSpace=false;
但是为了进一步编码,我得到了这个警告信息。
Warning: DOMDocument::loadHTML(): Unexpected end tag : fragmentinstance in Entity, line: 123 in C:\xampp\htdocs\YeBeSis\mhra.php on line 4
4行是$doc->loadHTML($mhraWebUygulamasi);
其他行号可能目标URL的HTML代码。 如何轻松处理目标网址并将其加载到DOM容器?我哪里做错了?
这有帮助吗? [http://stackoverflow.com/questions/6090667/php-domdocument-errors-warnings-on-html5-tags](http://stackoverflow.com/questions/6090667/php-domdocument-errors-warnings-on- html5-tags) – gmartellino 2013-03-15 23:07:50
谢谢。这个链接非常有说服力。但是,我应该处理目标网址html加上supress(禁用)警告消息。我会尝试@Sheikh Heera的解决方案。 – caglaror 2013-03-16 18:29:07