简体   繁体   English

如何使用PA API在网站上获取产品价格

[英]How to get product price on website with PA API

So i am completly new to the AWS and it seems very complicated at first. 因此,我完全不熟悉AWS,起初看起来非常复杂。 My plan was to get prices of products on my website using their ASIN. 我的计划是使用他们的ASIN在我的网站上获得产品价格。 So i went to the scratchpad and tried my best, but no matter what i do i get an 503 error, saying im sending to many request to rapidly, which is obviously not the case. 因此,我去了便笺簿并尽了最大的努力,但是无论我做什么,我都会遇到503错误,并说我正在迅速发送许多请求,但事实并非如此。 I tried it 4-5 times over the last 2 days, yet the same error remains. 在过去2天中,我尝试了4-5次,但仍然存在相同的错误。

In the support forum, i found people with a similiar problem and some answers stating that the new rules only make it possible for websites of high profit to send requests. 在支持论坛中,我发现有人遇到类似的问题,并回答了一些问题,指出新规则仅使高利润的网站能够发送请求。 Now my website is supposed to compare prices, and without showing the latest prices, my profit wont reach the point where i can send requests. 现在我的网站应该比较价格,并且不显示最新价格,我的利润将达不到我可以发送请求的程度。 This is what the Scratchpad gave me: 这是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."\"";

 ?>

So if there is nothing wrong with what i did, and there is no way for me to send requests, how can i get the prices on my website using the ASIN? 因此,如果我所做的事情没有错,并且没有发送请求的方式,我如何使用ASIN在我的网站上获得价格? Im running out of ideas to get this to work. 我没有足够的想法来使它起作用。

Any help is highly appreciated! 任何帮助深表感谢!

Amazon product advertising API doesn't work properly if you don't already have a few sales. 如果您的销售量不大,Amazon产品广告API将无法正常运行。 If you don't, you either need to scrape it yourself or use other third party API. 如果您不这样做,则需要自己对其进行爬取或使用其他第三方API。 We use the amazon-price API from RapidAPI, it supports price/rating/review count fetching for up to 1000 products in a single request. 我们使用RapidAPI的amazon-price API,它支持单个请求中多达1000种产品的价格/评分/评论计数获取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM