【发布时间】:2013-05-02 23:32:40
【问题描述】:
这让我停留了一段时间,所以我想我会发布它。我的问题是我的 find-> 工作不正常并且 $product_name 出现空
require 'mysql_con.php';
require 'simple_html_dom.php';
$html = file_get_html('http://www.xxxx.com/index.php?main_page=index&cPath=23');
/* foreach($html->find('img') as $element) {
echo $element->src . '<br>';
} */
$find = $html->find('#specialsListing .specialsListBoxContents .indent a');
$i=0;
foreach ($find as $test) {
$link = html_entity_decode($test->href);
$linkgrab = file_get_html($link);
$product_name = $linkgrab->find('#productName')->innertext;
echo $product_name;
break;
}
【问题讨论】:
标签: php dom screen-scraping simpledom