1
如何找到此代碼工作所需的密鑰?Amazon Associates - 找不到關聯標籤,API和密鑰
<?php
/**
* For a running Search Demo see: http://amazonecs.pixel-web.org
*/
if ("cli" !== PHP_SAPI)
{
echo "<pre>";
}
defined('AWS_API_KEY') or define('AWS_API_KEY', '...');
defined('AWS_API_SECRET_KEY') or define('AWS_API_SECRET_KEY', '...');
defined('AWS_ASSOCIATE_TAG') or define('AWS_ASSOCIATE_TAG', '...');
// require '../lib/AmazonECS.class.php';
require_once (dirname(__FILE__) . '/../classes/buyamerica/AmazonECS.class.php');
try
{
$amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'com', AWS_ASSOCIATE_TAG);
// for the new version of the wsdl its required to provide a associate Tag
// @see https://affiliate-program.amazon.com/gp/advertising/api/detail/api-changes.html?ie=UTF8&pf_rd_t=501&ref_=amb_link_83957571_2&pf_rd_m=ATVPDKIKX0DER&pf_rd_p=&pf_rd_s=assoc-center-1&pf_rd_r=&pf_rd_i=assoc-api-detail-2-v2
// you can set it with the setter function or as the fourth paramameter of ther constructor above
$amazonEcs->associateTag(AWS_ASSOCIATE_TAG);
// First of all you have to set an another ResponseGroup. If not the request would not be successful
// Possible Responsegroups: BrowseNodeInfo,MostGifted,NewReleases,MostWishedFor,TopSellers
$amazonEcs->responseGroup('BrowseNodeInfo');
// $asin = "B00625Q56U";
$asin = $_REQUEST["asin"];
$res = $amazonEcs->responseGroup('Large')->lookup($asin);
var_dump($res->Items->Item);
}
catch(Exception $e)
{
echo $e->getMessage();
}
if ("cli" !== PHP_SAPI)
{
echo "</pre>";
}