I am trying to use amazon api code in php but it is giving me error of not supported version following is my code

Paras

following is the code which i am using with php to get xml response with amazon api service but it is giving me error stated as below of code.

<?php

// Your AWS Access Key ID, as taken from the AWS Your Account page
$aws_access_key_id = "A*********A";

// Your AWS Secret Key corresponding to the above ID, as taken from the AWS Your Account page
$aws_secret_key = "ue*******s+";

// The region you are interested in
$endpoint = "webservices.amazon.in";

$uri = "/onca/xml";

$params = array(
    "Service" => "AWSECommerceService",
    "Operation" => "ItemSearch",
    "AWSAccessKeyId" => "AKIAJYSYWXDOF5CWIK5A",
    "AssociateTag" => "unity0f-21",
    "SearchIndex" => "All",
    "Keywords" => "iphone",
    "ResponseGroup" => "Images,ItemAttributes,Offers"
);

// Set current timestamp if not set
if (!isset($params["Timestamp"])) {
    $params["Timestamp"] = gmdate('Y-m-d\TH:i:s\Z');
}

// Sort the parameters by key
ksort($params);

$pairs = array();

foreach ($params as $key => $value) {
    array_push($pairs, rawurlencode($key)."=".rawurlencode($value));
}

// Generate the canonical query
$canonical_query_string = join("&", $pairs);

// Generate the string to be signed
$string_to_sign = "GET\n".$endpoint."\n".$uri."\n".$canonical_query_string;

// Generate the signature required by the Product Advertising API
$signature = base64_encode(hash_hmac("sha256", $string_to_sign, $aws_secret_key, true));

// Generate the signed URL
$request_url = 'http://'.$endpoint.$uri.'?'.$canonical_query_string.'&Signature='.rawurlencode($signature);

echo "Signed URL: \"".$request_url."\"";

?>

it is giving error as unsupported version i tried everything but still error is occurring please help
response of the request for the xml file is as following:

 <?xml version="1.0"?>
    <ItemSearchErrorResponse
        xmlns="http://ecs.amazonaws.com/doc/2005-10-05/">
        <Error>
            <Code>UnsupportedVersion</Code>
            <Message>Version 2005-10-05 is unsupported. Please use 2011-08-01 or greater instead.</Message>
        </Error>
        <RequestId>9f95a47d-f593-4002-af01-85b1b12fdf2d</RequestId>
    </ItemSearchErrorResponse>
fridge_light

Add a valid version to your $params array, e.g:

"ResponseGroup" => "Images,ItemAttributes,Offers",
"Version" => "2015-10-01"

I tested your script and found it works with the above.

The cause of the issue seems to be that the API defaults to a deprecated value if you omit the version parameter.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

why is my code giving me a settext error?

I am trying to run the app on my Android 10 device and the following error is shown - minSdk(API 30) > deviceSdk(API 29)

When i am trying to run this code i am getting the following error

I am getting following error when i was trying run Angular 7 code on stackblitz from github repo

I am trying to use sharedPreferences from my Register Page and retrieve it on another class, but it is giving me error in the logcat

My python code consist of a dictionary ,The code is giving key error :7. can anyone help me understand what i am doing wrong?

I am trying to run a task in my async method but it's giving me a ui thread error

Youtube analytics api giving 'Code:400 The query is not supported.' error

Why is my code not showing any output? I am trying to use while loop to debug the error i was getting before it

I am trying to make my php main class compress and use it like normal php code

Why my code giving me a stackdump error when I run it?

I am trying to build my game in unity but it is giving me an error

Why am I getting an Undifined Index error in my php code?

I am trying the following code , but it is throwing exception

a line in my code is giving me "subscript out of range error"

I am not able to use jAlert in my code ?

I am starting to use Perl Tk for my UI design in. I created a small code in perl and got the following error

Why is the following sass code giving me an error?

I am trying to understand the following javascript code

I am trying to connect to mysql database with php code but it gives me this errors (see below)

i am trying to create foreign keys but i got error 1822 .. please see my code below

I am trying to use a slider component in my angular project i have ran the ng add @angular/material still the following error

I am receiving the following error when executing my code - EOFError: EOF when reading a line

I get error on my react-native app while I am trying to execute following code

I am not able to delete items in my todo list made with react, please help me with error in my code

Why my code is giving error after i submit code

I am trying to delete some emails, but when I run the code I get the following error: TypeError: 'module' object is not callable (env)

I am trying to create circle avatar in Flutter. I have tried this but not giving me circle please check the code bellow:

Why am I not able to fetch email with the following code (the second console statement not giving me anything)?