1

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);

署名パラメーターを含めていますが、まだエラーが発生しています。

4

0 に答える 0