PHP Amazon API Signature does not Match -


i trying signature amazon api. have tryied many ways, not working.

this output when load site:

signaturedoesnotmatchthe request signature calculated not match signature provided. check aws secret access key , signing method. consult service documentation details.a0276c00-dab6-4993-bfba-f1c9e431be72

the link:

http://webservices.amazon.de/onca/xml?awsaccesskeyid=akiaiapozfmtww53xw3a&associatetag=myassociatetag&itemid=b017m5otu2&operation=itemlookup&responsegroup=images&service=awsecommerceservice&timestamp=2016-09-22t15%3a37%3a01z&version=2011-08-01&idtype=asin&signature=t4n0bqqbssbu8pvljawhsvno4bmdltwmlv%2fmaekapbw%3dh

the code:

function aws_signed_request($region, $params, $public_key, $private_key, $associate_tag=null, $version='2011-08-01') {     /*     copyright (c) 2009-2012 ulrich mierendorff  permission hereby granted, free of charge, person obtaining copy of software , associated documentation files (the "software"), deal in software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of software, , permit persons whom software furnished so, subject following conditions:  above copyright notice , permission notice shall included in copies or substantial portions of software.  software provided "as is", without warranty of kind, express or implied, including not limited warranties of merchantability, fitness particular purpose , noninfringement. in no event shall authors or copyright holders liable claim, damages or other liability, whether in action of contract, tort or otherwise, arising from, out of or in connection software or use or other dealings in software. */  /* parameters:     $region - amazon(r) region (ca,com,co.uk,de,fr,co.jp)     $params - array of parameters, eg. array("operation"=>"itemlookup",                     "itemid"=>"b000x9flkm", "responsegroup"=>"small")     $public_key - "access key id"     $private_key - "secret access key"     $version (optional) */  // paramters $method = 'get'; $host = 'webservices.amazon.'.$region; $uri = '/onca/xml';  // additional parameters $params['service'] = 'awsecommerceservice'; $params['awsaccesskeyid'] = $public_key; // gmt timestamp $params['timestamp'] = gmdate('y-m-d\th:i:s\z'); // api version $params['version'] = $version; if ($associate_tag !== null) {     $params['associatetag'] = $associate_tag; }  // sort parameters ksort($params);  // create canonicalized query $canonicalized_query = array(); foreach ($params $param=>$value) {     $param = str_replace('%7e', '~', rawurlencode($param));     $value = str_replace('%7e', '~', rawurlencode($value));     $canonicalized_query[] = $param.'='.$value; } $canonicalized_query = implode('&', $canonicalized_query);  // create string sign $string_to_sign = $method."\n".$host."\n".$uri."\n".$canonicalized_query;  // calculate hmac sha256 , base64-encoding $signature = base64_encode(hash_hmac('sha256', $string_to_sign, $private_key, true));  // encode signature request $signature = str_replace('%7e', '~', rawurlencode($signature));  // create request $request = 'http://'.$host.$uri.'?'.$canonicalized_query.'&idtype=asin&signature='.$signature;  return $request; } ?> 

the request file:

    <?php require('aws_signed_request.php');   $amazon = aws_signed_request('de',array('operation'=>'itemlookup','itemid'=>'b017m5otu2', 'responsegroup'=>'images'),"akiaiapozfmtww53xw3a","okguh77p2vnchk5d+6z4wnein18gpkuzolizzrpe","my associate tag");     echo($amazon); ?> 

i hope can me or have resolution!

greetings


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -