我正在尝试将Amazon Product API集成到我的网站中,并且发现了几个帮助我构建URL的帖子.唯一的问题是当我执行下面的代码时,我得到以下错误.难道我做错了什么?
内部服务器错误服务器遇到内部错误或配置错误,无法完成您的请求.请联系服务器管理员awsadmin@amazon.com并告知他们错误发生的时间,以及可能导致错误的任何操作.服务器错误日志中可能提供了有关此错误的更多信息.
$AWS_ACCESS_KEY_ID = "[myaccesskeyhere]";
$AWS_SECRET_ACCESS_KEY = "[mysecretkeyhere]";
$base_url = "http://ecs.amazonaws.com/onca/xml?";
$url_params = array('Operation'=>"ItemSearch",'Service'=>"AWSECommerceService",
'AWSAccessKeyId'=>$AWS_ACCESS_KEY_ID,'AssociateTag'=>"yourtag-10",
'Version'=>"2006-09-11",'Availability'=>"Available",'Condition'=>"All",
'ItemPage'=>"1",'ResponseGroup'=>"Images,ItemAttributes,EditorialReview",
'Keywords'=>"Amazon");
// Add the Timestamp
$url_params['Timestamp'] = gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time());
// Sort the URL parameters
$url_parts = array();
foreach(array_keys($url_params) as $key)
$url_parts[] = $key."=".$url_params[$key];
sort($url_parts);
// Construct the string to sign
$string_to_sign = "GET\necs.amazonaws.com\n/onca/xml\n".implode("&",$url_parts);
$string_to_sign = str_replace('+','%20',$string_to_sign);
$string_to_sign = str_replace(':','%3A',$string_to_sign);
$string_to_sign = str_replace(';',urlencode(';'),$string_to_sign);
// Sign the request
$signature = hash_hmac("sha256",$string_to_sign,$AWS_SECRET_ACCESS_KEY,TRUE);
// Base64 encode the signature and make it URL safe
$signature …Run Code Online (Sandbox Code Playgroud) 对于我网站上的每种产品,我都有一个页面来宣传几本来自亚马逊的书。我使用AWSECommerceService从Web服务器查询到的书。我从亚马逊收到的XML包含书籍列表,其中包含诸如标题,价格,图像URL等信息。我使用这些信息生成我的网站页面。Amazon提供的图像URL都是HTTP,而我需要使用HTTPS协议发布它们,以避免在浏览器控制杆上警告页面访问者。只需更换HTTP与HTTPS不工作。
例:
http://ecx.images-amazon.com/images/I/51tD0SDNMeL.SX166.jpg =>确定
https://ecx.images-amazon.com/images/I/51tD0SDNMeL.SX166.jpg => ERR_CERT_COMMON_NAME_INVALID
有什么建议吗?
我正在使用boto3定价客户端来获得按需定价,因为boto3 ec2客户端没有按需定价,而是现货定价。
这给了我错误的说法Could not connect to the endpoint URL: "https://api.pricing.us-west-2.amazonaws.com/。
以下是我们西2的正确区域名称或位置值是多少。我检查了这些区域,这是正确的区域。定价API是否不在俄勒冈州地区?
pricing = boto3.client('pricing', region_name='us-west-2')
response = pricing.get_products(
ServiceCode='AmazonEC2',
Filters=[
{'Type': 'TERM_MATCH', 'Field': 'operatingSystem', 'Value': 'Linux'},
{'Type':'TERM_MATCH', 'Field': 'location', 'Value': 'US West (Oregon)'}
],
MaxResults=20
)
for price in response['PriceList']:
resp = json.loads(price)
on_demand = resp['terms']['OnDemand']
print len(on_demand)
print(on_demand)
Run Code Online (Sandbox Code Playgroud) 我已经成功地使用Amazon在Amazon发布了产品MWS Feeds API。现在,我想使用Products API列出这些产品,但是我遇到了一些错误。我跑GetMatchingProductSample.php。
捕获的异常:找不到所需的参数ASINList响应状态代码:400错误代码:MissingParameter错误类型:发件人请求ID:8bb9c8d1-f48c-495c-be86-89492976b4a9 XML:SenderMissingParameterRequired参数ASINList未找到8bb9c8d1-f48c-495c-be86-89492976b4a9:Header RequestId:8bb9c8d1-f48c-495c-be86-89492976b4a9
码:
<?php
require_once('.config.inc.php');
$serviceUrl = "https://mws-eu.amazonservices.com/Products/2011-10-01";
$config = array (
'ServiceURL' => $serviceUrl,
'ProxyHost' => null,
'ProxyPort' => -1,
'ProxyUsername' => null,
'ProxyPassword' => null,
'MaxErrorRetry' => 3,
);
$service = new MarketplaceWebServiceProducts_Client(
AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY,
APPLICATION_NAME,
APPLICATION_VERSION,
$config);
$request = new MarketplaceWebServiceProducts_Model_GetMatchingProductRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeGetMatchingProduct($service, $request);
function invokeGetMatchingProduct(MarketplaceWebServiceProducts_Interface $service, $request)
{
try {
$response = $service->GetMatchingProduct($request);
echo ("Service Response\n");
echo ("=============================================================================\n");
$dom = new …Run Code Online (Sandbox Code Playgroud)