簡體   English   中英

如何使用PA API在網站上獲取產品價格

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

因此,我完全不熟悉AWS,起初看起來非常復雜。 我的計划是使用他們的ASIN在我的網站上獲得產品價格。 因此,我去了便箋簿並盡了最大的努力,但是無論我做什么,我都會遇到503錯誤,並說我正在迅速發送許多請求,但事實並非如此。 在過去2天中,我嘗試了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在我的網站上獲得價格? 我沒有足夠的想法來使它起作用。

任何幫助深表感謝!

如果您的銷售量不大,Amazon產品廣告API將無法正常運行。 如果您不這樣做,則需要自己對其進行爬取或使用其他第三方API。 我們使用RapidAPI的amazon-price API,它支持單個請求中多達1000種產品的價格/評分/評論計數獲取。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM