Amazon AWS API

The Amazon Associates Web Service lets you search for and fetch information about items in Amazon's catalogue.

Here's a brief example, in this case searching for books by a specific publisher, ordered by sales rank:

// Note: pass in the publisher to search for as an argument
$xml = simplexml_load_file(
  '' . // suffix for country
  'onca/xml?Service=AWSECommerceService&Version=2007-10-29' .
  '&AWSAccessKeyId=1SVFNCKVJ7JWK2NPG002' . // AWS developer ID
  '&Operation=ItemSearch&ResponseGroup=Medium' .
  '&Availability=Available&Condition=All&MerchantId=Amazon' .
  '&SearchIndex=Books' . // type of product
  '&Sort=salesrank' . // sort order
  '&Publisher=' . urlencode($argv[1]) // search criteria
$items = array();
foreach ($xml->Items->Item as $item){
  $attrs = $item->ItemAttributes;
  $items[] = sprintf(
   '<div class="item">
     <div class="metadata">
       <img src="%s"/>
     <div class="metadata">
       <a href="%s">%s</a><br/>%s<br/>%s<br/>%s
   date('F Y', strtotime($attrs->PublicationDate)),
       <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
       <style type="text/css">
        div.metadata { float:left; margin-right: 2em; }
        div.item { float:left; clear: both; margin-bottom: 2em; }
  implode("\n", $items)