Amazon web services I';我得到了';请求必须包含参数签名';虽然我';我真的提供了
我正在用PhP尝试AWS产品广告API。 下面是我从net复制的PhP代码Amazon web services I';我得到了';请求必须包含参数签名';虽然我';我真的提供了,amazon-web-services,Amazon Web Services,我正在用PhP尝试AWS产品广告API。 下面是我从net复制的PhP代码 function callSOAPFunction($function, $array){ $timeStamp = gmdate("Y-m-d\TH:i:s\Z"); //service is always the same, $function is operation $string = 'AWSECommerceService'.$function.$timeStamp; $signature =
function callSOAPFunction($function, $array){
$timeStamp = gmdate("Y-m-d\TH:i:s\Z");
//service is always the same, $function is operation
$string = 'AWSECommerceService'.$function.$timeStamp;
$signature = base64_encode(hash_hmac("sha256", $string, 'MySecretKey', True));
$params = array('Service' => 'AWSECommerceService',
'AssociateTag' => 'Wassup?',
**'Signature' => $signature,**
'AWSAccessKeyId' => 'MyKey'
'Request' => array($array),
'Timestamp' => $timeStamp
);
$client = new
SoapClient("http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl",
array('exceptions' => 0));
return $client->__soapCall($function, array($params));
}
$array = array('Operation' => 'ItemSearchRequest',
'ItemPage' => 3,
'SearchIndex' => 'DVD',
'ResponseGroup' => 'Large',
'Keywords' => 'Karate');
$result = callSOAPFunction("ItemSearch", $array);
虽然我包含了signature参数,但仍然得到了错误。您在
'MyKey'
Hi Burhan之后缺少了一个逗号。Thaks指出了这一点,但这不是问题所在。我已经在代码中检查过了。