我想从第http://www.amazon.com/gp/offer-listing/B00PCPU9D6/ref=dp_olp_new?ie=UTF8&condition=new页
中获取一些数据当前代码:
<?php
$req = "http://www.amazon.com/gp/offer-listing/B00PCPU9D6/ref=dp_olp_new?ie=UTF8&condition=new";
$html = file_get_contents($req);
echo htmlentities($html);
print_r($html);
libxml_use_internal_errors( true);
$doc = new DOMDocument;
$doc->loadHTML( $html);
$xpath = new DOMXpath( $doc);
for($i=0;$i<10;$i++)
{
$node = $xpath->query( '//div[@class="a-column a-span2"]//span[@class="a-size-large a-color-price olpOfferPrice a-text-bold"]')->item($i);
$pricetxt = $node->textContent; // This will print **GET THIS TEXT**
$pricett = substr($pricetxt,10, 11);
$pricestr .= (float)$pricett."|";
}
$pricestr = rtrim($pricestr,"|");
echo $pricestr;
?>
有人请帮助我..如果您有任何其他解决方案,请告诉我。