【发布时间】:2011-01-20 22:53:56
【问题描述】:
好吧,这看起来很简单,但我根本无法让这个编码工作......
$html = new DOMDocument();
@$html->loadHtmlFile('http://www.groupon.com/deals/the-newfoundland-shop');
$xpath = new DOMXPath( $html );
$nodelist = $xpath->query( "/html/body/div[@id='global_container']/div[@id='main']/div[@id='content']/div/div[1]/div[2]/div[@id='number_sold_container']/table[1]/tbody/tr/td" );
foreach ($nodelist as $n){
echo $n->nodeValue."\n";
}
$buys = "$n->nodeValue";
在我松开它之前请帮忙...
谢谢
【问题讨论】:
-
(tipp) groupon.com/pages/api
-
@Gordon 你的冒险精神在哪里? ;-)
-
@middaparka 在阅读了groupon.com/terms 第 5 章后,我并没有 那么 喜欢冒险;)
标签: php xpath screen-scraping