Mug*_*les 3 php screen-scraping simple-html-dom
我正在使用Simple HTML Dom从远程网页上删除关键字,但我无法弄清楚如何实现这一点.
我目前正在使用以下代码.
$html = str_get_html($remote_html);
echo $html->find("meta[keywords]")->content;
Run Code Online (Sandbox Code Playgroud)
并收到以下错误:
Trying to get property of non-object
Run Code Online (Sandbox Code Playgroud)
小智 11
find()不返回对象,而是返回包含(在本例中)1个对象的数组."关键字"也不是属性,但"名称"是.使用:
$oHTML = str_get_html( $remote_html );
$arElements = $oHTML->find( "meta[name=keywords]" );
echo $arElements[0]->content;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9076 次 |
| 最近记录: |