我正在尝试从此范围获取内容
<span class="contact-seller-name ng-binding">martin</span>
这是我的代码
require 'simple_html_dom.php';
$url = "https://www.donedeal.ie/cars-for-sale/bmw-520d-m-sport-f10/14712042?campaign=3";
$html = file_get_html($url);
$value = $html->find("span[class*=contact-seller-name ng-binding]", 0);
echo $value->innertext;
但问题是我总是遇到这个错误:
注意:尝试获取非对象的属性 第30行的E:\ Programs \ xampp \ htdocs \ personal \ php \ tom \ WebScrapping \ test3.php
答案 0 :(得分:0)
尝试将$value
用作数组:
<?php
// finding against the mutltiple
// 0 is for the first span element
$value = $html->find('span#ur_span_id');
foreach($a_span as $p) {
$span_test = $p->outertext;
}
//can use class too in find section
?>