AmazonのAPIを利用して、値段価格監視ツールを作成しようとしています。
新品の最低価格と中古の最低価格を抽出することはできました。
しかし、さらに絞って中古の状態が「非常に良い」の最低価格なども抽出したいと思うようになりました。
どれだけAmazonから情報を受け取るかに関しては、パラメータのResponse Groupというものが関係しているということですが、どのパラメータに設定すればよいのかが分かりません。
誰か詳しい方いましたら教えてください。
Response Groupについての説明は英語ですが以下です。
https://docs.aws.amazon.com/ja_jp/AWSECommerceService/latest/DG/CHAP_ResponseGroupsList.html
ちなみに、OfferFullやLeargeなど試しましたが、そのようなデータは発見できませんでした。
もしくは他のパラメータで絞込をかけるのでしょうか?
ここで質問するのが正しいかは分かりませんがよろしくお願いします。
ちなみにコードは、以下のサイトを参考に作りました。
https://qiita.com/setouchi/items/f30606d0fc7cf716b920
php
1<?php 2$accessKey = "access"; 3$secretKey = "secret"; 4$associateTag = "tag"; 5$endpoint = "webservices.amazon.co.jp"; 6$uri = "/onca/xml"; 7 8foreach ([ 9 "Service" => "AWSECommerceService", 10 "Operation" => "ItemSearch", 11 "AWSAccessKeyId" => $accessKey, 12 "AssociateTag" => $associateTag, 13 "SearchIndex" => "Apparel", 14 "ResponseGroup" => "Images,ItemAttributes,Offers", 15 "Keywords" => "PS4 本体", 16 "Timestamp" => gmdate('Y-m-d\TH:i:s\Z') 17] as $key => $value) { 18 $params[rawurlencode($key)] = rawurlencode($value); 19}; 20 21ksort($params); 22 23$queries = []; 24foreach ($params as $key => $value) { 25 $queries[] = "$key=$value"; 26} 27 28$queryString = join("&", $queries); 29$signature = base64_encode(hash_hmac("sha256", join("\n", ["GET", $endpoint, $uri, $queryString]), $secretKey, true)); 30 31echo file_get_contents("https://$endpoint$uri?$queryString&Signature=" . rawurlencode($signature)); 32?>
回答1件
あなたの回答
tips
プレビュー