php - 未获取产品广告 API AWS 的促销摘要

标签 php codeigniter amazon-web-services amazon-product-api

我想在我的网站上显示来自 AWS 的优惠券、优惠和交易
例如

Promotion Summary

我从 Amazon Docs 尝试过什么我在 Php[Codeigniter] 工作,它也没有在 AWS 的暂存器上工作

http://webservices.amazon.in/onca/xml?
Service=AWSECommerceService&
AWSAccessKeyId=[AWS Access Key ID]&
AssociateTag=[Associate ID]&
Operation=ItemLookup&
ItemId=B000AQSMPO&
IdType=ASIN&
ResponseGroup=Offers,PromotionSummary&
Version=2013-08-01
&Timestamp=[YYYY-MM-DDThh:mm:ssZ]
&Signature=[Request Signature]

我想从这个休息服务中得到什么

<Promotions>
  <Promotion>
  <Summary>
    <PromotionId>A2QIQTNOFYRK5N</PromotionId>
    <Category>BuyAmountXGetAmountOffX</Category>
    <EligibilityRequirementDescription>Save $25.00 when you spend $125.00 or more on Kitchen & Housewares or Bed & Bath products offered by Amazon.com. Enter code AUGSAVER at checkout.</EligibilityRequirementDescription>
    <BenefitDescription>Save $25.00 when you spend $125.00 or more on Kitchen & Housewares or Bed & Bath products offered by Amazon.com. Enter code AUGSAVER at checkout.</BenefitDescription>
    <TermsAndConditions>.......</TermsAndConditions>
    </Summary>
  </Promotion>
</Promotions>

我得到了除促销摘要之外的所有内容

我正在使用 PHP CUrl 来获取响应

$request_url = 'http://'.$endpoint.$uri.'?'.$canonical_query_string.'&Signature='.rawurlencode($signature);

 //return $request_url;

  //  I prefer using CURL 
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL,$request_url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_TIMEOUT, 15);
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
 $xml_response = curl_exec($ch);

最佳答案

我在尝试 get product promotions 时遇到了同样的问题.困扰了我2天,我的脑子里闪过一个念头:产品促销信息没有显示,可能是因为它没有任何促销事件。 然后我检查了Amazon Promos Codesamazon associates 下.我点击了“当前促销代码”下方的链接,并在亚马逊产品页面上获得了一个 ASIN:“B00LV5NY3I”。

所以,我在 scratchpad 下运行这个任务:

https://webservices.amazon.com/onca/xml?
AWSAccessKeyId=[Your Access Key]&
AssociateTag=[Your Associate Tag]&
IdType=ASIN&
ItemId=B00LV5NY3I&
Operation=ItemLookup&
ResponseGroup=Offers,PromotionSummary&
Service=AWSECommerceService&
Timestamp=[YYYY-MM-DDThh:mm:ssZ]&
Signature=[Request Signature]

然后,我在响应中得到了 PromotionSummary:

<Promotions>
<Promotion>
<Summary>
<PromotionId>ATVP6WYIMZVUO</PromotionId>
<Category>BuyQuantityXGetPercentOffX</Category>
<EligibilityRequirementDescription>
Save 15% with this coupon. Enter code 4FCECM15 at checkout.
</EligibilityRequirementDescription>
<BenefitDescription>
Save 15% with this coupon. Enter code 4FCECM15 at checkout.
</BenefitDescription>
<TermsAndConditions>
<strong>To receive the Best Value discount:</strong> <ol><li>Add all products described in the promotion to your Shopping Cart in one of two ways:</li> <ul><li>Via the “Add both to Cart” button in the promotion description, OR</li> <li>Via the “Add to Shopping Cart” button on each respective product information page.</li> </ul> <li>The amount of the Best Value discount will be reflected on the final order checkout page and will be allocated proportionally to all promotion items in the Shopping Cart, including the Best Value item itself. For example, if the promotion offers $5 off one item worth $10 when you purchase two qualifying items worth $20 each, the $5 will be divided proportionately between the three items, so that the Best Value item will appear with a $1 discount, and each of the two other qualifying items will appear with a $2 discount.</li> </ol><strong>Terms and Conditions:</strong> <ul> <li>The promotion is valid for a limited time only. Amazon reserves the right to cancel it at any time.</li> <li>If you do not purchase the qualifying and Best Value items added to your Shopping Cart when the promotion is in effect, the discount will not apply.</li> <li>The promotion applies only to qualifying items displaying the offer message on their product information pages.</li> <li>The promotion applies only to products sold by the seller indicated in the offer message. It does not apply to the same products sold by other sellers. For example, if the promotion applies to cookware offered by Amazon.com, the same cookware offered by other sellers on the Amazon.com website (e.g. Macy’s, etc.) do not qualify.</li> <li>Unless the promotion indicates otherwise, it applies to the lowest priced qualifying item and may not be combined with other offers.</li> <li>All qualifying and Best Value items must be purchased in one order and shipped to a single address.</li> <li>If you return any of the promotion items, we will subtract your Best Value discount from your return credit.</li> <li>Shipping and handling charges apply to all products, including Best Value items.</li> <li>Add-on Items require a minimum purchase. See amazon.com/addon for details.</li> <li>This promotion may not be combined with other offers, including promotional certificates.</li> <li>Does not apply to orders placed with 1-Click.</li> <li>Offer good while supplies last.</li> <li>Void where prohibited.</li> <li>If you remove any of the promotion items from your Shopping Cart or violate any of the Terms and Conditions, the promotion will be invalid, and the discount will not apply.</li> </ul>
</TermsAndConditions>
</Summary>
</Promotion>
...
</Promotions>

已确认:如果您的促销请求遵循programming guide , 但响应不包含任何促销信息,那是因为返回的优惠没有任何促销信息,您需要尝试其他关键字、ItemId、SearchIndex、BrowseNode 或下一页(每个请求只返回 10 个项目)。

关于php - 未获取产品广告 API AWS 的促销摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36980451/

相关文章:

php - 为什么 pdo 不适用于具有空格字符的查询?

php - php中MySQL查询的问题

php - 如果未获取任何行,则 Codeigniter row_array 内容

amazon-web-services - 创建 EC2 实例时如何设置默认标签?

amazon-web-services - 适用于 VPC/VPN 的 AWS Cloudfront

php - 更改密码脚本有效但不会将正确的密码写入数据库

php - 如何在服务器上用 PHP 从 MySQL 查询中保存 CSV 文件

php - 电子邮件总是进入垃圾邮件文件夹

php - 需要添加表单验证codeigniter

c# - 如何使用 .net 在亚马逊中使用 sales-partner-api 加密和上传数据