xmlhttprequest - Amazon Product Advertising API: XML request problems -


i want "buy now" link , actualy amazo price of gaming product game-title. must use "search title" ( http://docs.aws.amazon.com/awsecommerceservice/latest/dg/ex_searchingbytitle.html ).

i found example xml-request , try build me.

the example was:

    $awsaccesskeyid = ""; $secretaccesskey = "";  $itemid = "0679722769"; // asin $timestamp = gmdate("y-m-d\th:i:s\z"); $timestamp = str_replace(":", "%3a", $timestamp); $responsegroup = "itemattributes,offers,images,reviews"; $responsegroup = str_replace(",", "%2c", $responsegroup);  $string = "awsaccesskeyid=$awsaccesskeyid& associatetag=xy& itemid=$itemid& operation=itemlookup& responsegroup=$responsegroup& service=awsecommerceservice& timestamp=$timestamp& version=2009-01-06";    $string = str_replace("\n", "", $string);  $prepend = "get\nwebservices.amazon.com\n/onca/xml\n"; $prependstring = $prepend . $string;  $signature = base64_encode(hash_hmac("sha256", $prependstring, $secretaccesskey, true));   $signature = str_replace("+", "%2b", $signature); $signature = str_replace("=", "%3d", $signature);  $baseurl = "http://webservices.amazon.com/onca/xml?"; $signedrequest = $baseurl . $string . "&signature=" . $signature;  $xml = simplexml_load_file($signedrequest);  echo '<a href="'.$signedrequest.'">xml</a><p>'; print_r ($xml); 

that works perfect, not search values. edit params , request broken.

my request:

    $awsaccesskeyid = ""; $secretaccesskey = "";  $itemid = "payday2"; // asin $timestamp = gmdate("y-m-d\th:i:s\z"); $timestamp = str_replace(":", "%3a", $timestamp); $responsegroup = "itemattributes"; $responsegroup = str_replace(",", "%2c", $responsegroup);  $string = "awsaccesskeyid=$awsaccesskeyid& associatetag=xy& operation=itemsearch& searchindex=game& title=$itemid& responsegroup=$responsegroup& service=awsecommerceservice& timestamp=$timestamp& version=2009-01-06";    $string = str_replace("\n", "", $string);  $prepend = "get\nwebservices.amazon.com\n/onca/xml\n"; $prependstring = $prepend . $string;  $signature = base64_encode(hash_hmac("sha256", $prependstring, $secretaccesskey, true));   $signature = str_replace("+", "%2b", $signature); $signature = str_replace("=", "%3d", $signature);  $baseurl = "http://webservices.amazon.com/onca/xml?"; $signedrequest = $baseurl . $string . "&signature=" . $signature;  $xml = simplexml_load_file($signedrequest);  echo '<a href="'.$signedrequest.'">xml</a><p>'; print_r ($xml); 

why request not work?

thanks

there's 2 potential problems i'm seeing here. first "game" doesn't seem valid input searchindex, videogames you're looking for. see here list of of them.

(outside can find applicable lists here)

the other potential problem see, , i'm not sure how flexible amazon's api this, there supposed space in game titled "payday 2". brings more important consideration fixing space. depending on how control have on entry of title whatever you're coding, might more flexible search based on keyword instead of title.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -