Php 文件\u get\u contents()不适用于amazon产品url
我想从第页获取一些数据 但是,文件\u get\u content无法获取此数据。我正在犯错误。 警告:文件获取内容[函数.文件获取内容]:无法打开流:HTTP请求失败!HTTP/1.1 503服务在第5行的C:\wamp\www\xx\ajax\testlist.php中不可用 当前代码:Php 文件\u get\u contents()不适用于amazon产品url,php,curl,amazon-web-services,amazon,file-get-contents,Php,Curl,Amazon Web Services,Amazon,File Get Contents,我想从第页获取一些数据 但是,文件\u get\u content无法获取此数据。我正在犯错误。 警告:文件获取内容[函数.文件获取内容]:无法打开流:HTTP请求失败!HTTP/1.1 503服务在第5行的C:\wamp\www\xx\ajax\testlist.php中不可用 当前代码: <?php $req = "http://www.amazon.com/gp/offer-listing/B00PCPU9D6/ref=dp_olp_new?ie=UTF8&c
<?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;
?>
有人请帮帮我。如果你有任何其他解决方案,请告诉我。因为你的行为违反了使用条款,他们可能会试图阻止你。你应该使用官方的亚马逊API,请参见:哦。谢谢你告诉我这一点,我不知道。我找不到任何能给我卖家列表的API。你找不到它,因为它不存在