所以我对AWS完全不熟悉,起初看起来很复杂。我的计划是使用他们的ASIN在我的网站上获得产品价格。所以我去了暂存器,并尽我所能,但不管我做什么,我得到503错误,说我快速发送到许多请求,这显然不是这种情况。在过去的两天里我尝试了4-5次,但仍然存在同样的错误。
在支持论坛中,我发现有类似问题的人和一些答案说明新规则只能使高利润的网站发送请求。现在我的网站应该比较价格,而没有显示最新的价格,我的利润将达不到我可以发送请求的点。这是Scratchpad给我的:
<?php
// Your Access Key ID, as taken from the Your Account page
$access_key_id = "Here is my access key";
// Your Secret Key corresponding to the above ID, as taken from the Your Account page
$secret_key = "Here is my secret key";
// The region you are interested in
$endpoint = "webservices.amazon.de";
$uri = "/onca/xml";
$params = array(
"Service" => "AWSECommerceService",
"Operation" => "ItemLookup",
"AWSAccessKeyId" => "Here is my access-key",
"AssociateTag" => "veganvergleic-21",
"ItemId" => "B078B745K3",
"IdType" => "ASIN",
"ResponseGroup" => "ItemAttributes,Offers"
);
// Set current timestamp if not set
if (!isset($params["Timestamp"])) {
$params["Timestamp"] = gmdate('Y-m-d\TH:i:s\Z');
}
// Sort the parameters by key
ksort($params);
$pairs = array();
foreach ($params as $key => $value) {
array_push($pairs, rawurlencode($key)."=".rawurlencode($value));
}
// Generate the canonical query
$canonical_query_string = join("&", $pairs);
// Generate the string to be signed
$string_to_sign = "GET\n".$endpoint."\n".$uri."\n".$canonical_query_string;
// Generate the signature required by the Product Advertising API
$signature = base64_encode(hash_hmac("sha256", $string_to_sign, $secret_key, true));
// Generate the signed URL
$request_url = 'https://'.$endpoint.$uri.'?'.$canonical_query_string.'&Signature='.rawurlenco de($signature);
echo "Signed URL: \"".$request_url."\"";
?>
因此,如果我所做的事情没有任何问题,并且我无法发送请求,我如何使用ASIN在我的网站上获得价格?我没有想法让这个工作。
任何帮助都非常感谢!
如果您还没有一些销售,亚马逊产品广告API将无法正常运行。如果不这样做,您需要自己抓取它或使用其他第三方API。我们使用RapidAPI的amazon-price API,它支持单个请求中最多1000个产品的价格/评级/评论计数。