我收到'请求必须包含参数签名',虽然我实际上是在提供它

时间:2012-08-18 00:46:03

标签: amazon-web-services

我正在PhP中尝试AWS Product Advertisement API。 这是我从网上复制的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 = 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);

虽然我包含签名参数,但我仍然收到错误。

0 个答案:

没有答案