【发布时间】:2016-04-09 18:30:27
【问题描述】:
我正在尝试使用PHP Simple HTML DOM PARSER 从this site 提取包括文本在内的文章链接。
我想提取主页中文章的所有h2标签,我正在尝试这样做:
$html = file_get_html('http://www.winbeta.org');
$articles = $html->getElementsByTagName('article');
$a = null;
foreach ($articles->find('h2') as $header) {
$a[] = $header;
}
print_r($a);
根据手册,它应该首先获取article标签内的所有内容,然后为每篇文章提取h2并保存在数组中。但它给了我:
【问题讨论】:
标签: php html dom simple-html-dom