我想在我的magento网站上显示亚马逊客户评论... 我搜索了很多,我发现了一些链接,向我展示了这个步骤..
<iframe src="http://www.amazon.com/reviews/iframe?akid=[AWS Access Key ID]&asin=0316067938&exp=2011-08-01T17%3A54%3A07Z&linkCode=xm2&summary=0&tag=ws&truncate=256&v=2&sig=[Signature]" />
在此iframe AWSAccessKeyId 且签名正在使用....我获得了AWSAccessKeyId,但我没有找到签名。< / p>
所以请您告诉我,从哪里可以获得亚马逊的签名密钥。
答案 0 :(得分:1)
我们可以使用Amazon-ECS-PHP-Library轻松获取客户评论 .By使用这个类,应用程序根据其ISBN号生成一个亚马逊页面的URL,其中只有评论。
代码
# see comment above about 10 and 13 digit ISBNs
if($reviews = getAmazonReviews($book['ISBN_10']))
{
$amazonReviewsIframe = $reviews;
}
else
{
$asin = isbnToAsin($book['ISBN_13']);
$amazonReviewsIframe = getAmazonReviews($asin);
}
if($amazonReviewsIframe)
{
echo "<a class='fboxEdit' href='$amazonReviewsIframe'>Amazon</a>";
}
# get the first two values from the Product Advertising API,
# last 2 values are needed for Amazon-ECS-PHP-Library
define("API_KEY", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
define("API_SECRET", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
define("COUNTRY_CODE", "com");
define("ASSOC_TAG", "myrealis");
function amazonApi()
{
# https://github.com/Exeu/Amazon-ECS-PHP-Library/blob/master/lib/AmazonECS.class.php
require_once 'AmazonECS.class.php';
$client = new AmazonECS(API_KEY, API_SECRET, COUNTRY_CODE, ASSOC_TAG);
return $client;
}
function getAmazonReviews($asin)
{
$client = amazonApi();
$response = $client->category('Books')->responseGroup('Reviews')->search($asin);
if($response->Items->Item->ASIN == $asin)
{
return $response->Items->Item->CustomerReviews->IFrameURL;
}
else
{
return False;
}
}
function isbnToAsin($isbn)
{
$client = amazonApi();
# I extended the AmazonECS.class with the "lookupIsbn" function
$response = $client->category('Books')->lookupIsbn($isbn);
if(isset($response->Items->Item->ASIN)) {
return $response->Items->Item->ASIN;
} else {
return False;
}
}
# added inside the AmazonECS.class
public function lookupIsbn($isbn)
{
$params = $this->buildRequestParams('ItemLookup', array(
'ItemId' => $isbn, 'IdType' => 'ISBN', 'SearchIndex' => 'Books'
));
return $this->returnData(
$this->performSoapRequest("ItemLookup", $params)
);
}
请查看此链接,了解详情.. Show Amazon book reviews on your site with the Product Advertising API