amazon_ean_to_asin

Versions
6
amazon_ean_to_asin($ean)

Given an EAN (ISBN-13), try to get Amazon to give it to us.

see https://affiliate-program.amazon.com/gp/associates/help/t5/a16?ie=UTF8&p...

Parameters

$ean The EAN, ISBN-13 value

Return value

The asin, or NULL if unsuccessful.

Code

contrib-6/amazon/amazon.module, line 677

<?php
function amazon_ean_to_asin($ean) {
  $asin = NULL;
  $params = array(
    'ItemId' => $ean,
    'IdType' => 'EAN',
    'SearchIndex' => 'Books',
  );
  $results = amazon_http_request('ItemLookup', $params);
  if (!empty($results->Items->Item->ASIN)) {
    $asin = (string)$results->Items->Item->ASIN;
  }
  return $asin;
}
?>

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options