Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

amazon.inc.php

Go to the documentation of this file.
00001 <?
00002 class Amazon extends REST
00003 {
00004     function __construct($key = null)
00005     {
00006         //setup our key
00007         if ($key !== null)
00008             $this->key = $key;
00009         else if (Config::get('amazon_aws_key'))
00010             $this->key = Config::get('amazon_aws_key');
00011         
00012         //call mommy.
00013         parent::__construct('http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=' . $this->key);
00014     }
00015 
00016     public function lookupAsins($search, $searchIndex = null)
00017     {
00018         //init.
00019         $asins = array();
00020 
00021         //default to Blended
00022         if ($searchIndex === null)
00023             $searchIndex = 'Blended';
00024 
00025         //get our xml data.
00026         $data = $this->request(array(
00027             'Operation' => 'ItemSearch',
00028             'Keywords' => $search,
00029             'SearchIndex' => $searchIndex,
00030             'ResponseGroup' => 'ItemIds'
00031         ));
00032 
00033         //simple xml certainly doesnt describe how easy it is to use.  fuckers.
00034         $xml = simplexml_load_string($data);
00035         $list = $xml->Items;
00036         foreach ($list->Item AS $item)
00037             $asins[] = (string)$item->ASIN;
00038 
00039         return $asins;
00040     }
00041 }
00042 ?>

Generated on Fri Oct 27 12:26:40 2006 for BaseJumper by doxygen 1.3.9.1