【发布时间】:2011-02-11 18:24:43
【问题描述】:
我正在尝试解析一些不在我的服务器上的 html
$dom = new DOMDocument();
$dom->loadHTMLfile("http://www.some-site.org/page.aspx");
echo $dom->getElementById('his_id')->item(0);
但是 php 返回类似ID his_id already defined in http://www.some-site.org/page.aspx, line: 33 的错误。我认为这是因为 DOMDocument 正在处理无效的 html。那么,即使无效,我该如何解析它?
【问题讨论】:
标签: php html-parsing domdocument