PHP HTML DOM Parser
Possible Duplicate:
How to parse and process HTML with PHP?
I'm looking into HTML DOM parsers for PHP. I've found PHP Simple HTML DOM Parser. Are there any others I should be looking at?
Yes. Simple html doc is fine, but an order of magnitude slower than the built in dom parser.
$dom = new DOMDocument();
@$dom->loadHTML($html);
$x = new DOMXPath($dom);
foreach($x->query("//a") as $node)
{
$data['dom']['href'][] = $node->getAttribute("href");
}
Use that.
You can look at the builtin DOM
http://php.net/dom
最近我也发现了ganon,但总的来说PHP简单的HTML DOM解析器是最好的!
链接地址: http://www.djcxy.com/p/29898.html上一篇: 如何使用PHP解析HTML表格?
下一篇: PHP HTML DOM解析器