【发布时间】:2013-02-15 15:21:08
【问题描述】:
我想从提供的特定 url 解析 HTML 数据。但我无法解析数据,因为我遇到的错误很少。
这是我的代码:-
$html = new DOMDocument();
$html->loadHTML($url); //$url is where the site url is defined
$value = array();
foreach($html->find($identifier) as $element) //$identifier is where div, a etc is stored
{
$value[] = $element->src."<br />";
}
print_r($value);
我收到以下错误
Call to undefined method DOMDocument::find()
谁能帮我解决这个问题。我使用的是 cake-php 2.0
【问题讨论】:
-
identifier的具体例子是什么? -
例如我取$identifier = div