Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8661529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:31:07+00:00 2026-06-12T16:31:07+00:00

I am attempting to use the Amazon MWS GetMatchingProductForId API, and I am stuck

  • 0

I am attempting to use the Amazon MWS GetMatchingProductForId API, and I am stuck on trying to get information for multiple isbn’s. The format needs to be in the form of: IdList.Id.1=isbn[x], where isbn[x] would be my array. I need to be able to list them in a list of 20 (ie. IdList.Id.1=, IdList.Id.2= …IdList.Id.20= ). I thought I could use implode($isbn) like this:

$count=0;
function ProductId_xml($searchTerm) {

$params = array(
    'AWSAccessKeyId' => AWS_ACCESS_KEY_ID,
    'Action' => "GetMatchingProductForId",
    'SellerId' => MERCHANT_ID,
    'SignatureMethod' => "HmacSHA256",
    'SignatureVersion' => "2",
    'Timestamp'=> gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()),
    'Version'=> "2011-10-01",
    'MarketplaceId' => MARKETPLACE_ID,
    'IdType' => "ISBN",
    );

$id=array(explode(',',$searchTerm));
foreach ($id as $newId)
{
$count .= $count +1;    
    $params += array('IdList.Id.'.$count => $newId);

} //end of foreach      
// Sort the URL parameters
$url_parts = array();
foreach(array_keys($params) as $key)
    $url_parts[] = $key . "=" . str_replace('%7E', '~', rawurlencode($params[$key]));
sort($url_parts);

// Construct the string to sign
$url_string = implode("&", $url_parts);
$string_to_sign = "GET\nmws.amazonservices.com\n/Products/2011-10-01\n" . $url_string;

// Sign the request
$signature = hash_hmac("sha256", $string_to_sign, AWS_SECRET_ACCESS_KEY, TRUE);

// Base64 encode the signature and make it URL safe
$signature = urlencode(base64_encode($signature));

$url = "https://mws.amazonservices.com/Products/2011-10-01" . '?' . $url_string . "&Signature=" . $signature;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$response = curl_exec($ch);

    $parsed_xml = simplexml_load_string($response);

return ($parsed_xml);
}
}
?>

$searchterm is my array of isbn numbers, but that only lists them as a string of isbn’s.
I know that this works if I only use one isbn at a time, but I need to run them in batches of 20 to speed up my process.
I am not sure where to go from here. Any help would be greatly appreciated.
EDIT: I have updated the function so that it will include the batch of 20 isbn’s in $params, but I am not sure that the way I added it is correct.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:31:08+00:00Added an answer on June 12, 2026 at 4:31 pm
    function ProductId_xml($searchTerm) {
    $count=0;
    $id=array(explode(',',$searchTerm));
    foreach ($id as $newId)
    {
    $count .= $count +1;
    $params = array(
    'AWSAccessKeyId' => AWS_ACCESS_KEY_ID,
    'Action' => "GetMatchingProductForId",
    'SellerId' => MERCHANT_ID,
    'SignatureMethod' => "HmacSHA256",
    'SignatureVersion' => "2",
    'Timestamp'=> gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()),
    'Version'=> "2011-10-01",
    'MarketplaceId' => MARKETPLACE_ID,
    'IdType' => "ISBN",
    'IdList.Id.'.$count => $newId,
    );
    run query here;
    }
    

    Haven’t tested but that should work, it will explodes the $searchTerm to an array by commas, then iterates through them. I don’t know the Amazon API this will run them one at a time through the query, but at least it allows you to automate the process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to use the amazon API to obtain product data and currently failing miserably.
Im attempting to use websockets for a project. It needs to use the ipad,
I am attempting to use the Yahoo! Finance API to gather current stock quotes
I'm attempting use the REST API in my rails (version 3.2.9) app. I am
I'm attempting to use a form post to add rows to a mySQL table.
I'm attempting to use a form post to add rows to a mySQL table.
attempting to use this railscast as a guide: http://railscasts.com/episodes/197-nested-model-form-part-2?view=asciicast and running into this error:
When attempting to use the TCPProxy tool included with The Grinder, I get the
I am attempting to use the crypt gem. While I am able to get
When attempting to use ldap_connect() , I get this error: Fatal error: Call to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.