Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store


Zend_Service_Amazon is a simple API for using Amazon web services. Zend_Service_Amazon has two APIs: a more traditional one that follows Amazon's own API, and a simpler "Query API" for constructing even complex search queries easily.

Zend_Service_Amazon enables developers to retrieve information appearing throughout web sites directly through the Amazon Web Services API. Examples include:

  • Store item information, such as images, descriptions, pricing, and more

  • Customer and editorial reviews

  • Similar products and accessories

  • offers

  • ListMania lists

In order to use Zend_Service_Amazon, you should already have an Amazon developer API key aswell as a secret key. To get a key and for more information, please visit the Amazon Web Services web site. As of August 15th, 2009 you can only use the Amazon Product Advertising API through Zend_Service_Amazon, when specifying the additional secret key.


Your Amazon developer API and secret keys are linked to your Amazon identity, so take appropriate measures to keep them private.

Example 710. Search Amazon Using the Traditional API

In this example, we search for PHP books at Amazon and loop through the results, printing them.

= new Zend_Service_Amazon('AMAZON_API_KEY''US''AMAZON_SECRET_KEY');
$results $amazon->itemSearch(array('SearchIndex' => 'Books',
'Keywords' => 'php'));
foreach (
$results as $result) {
$result->Title '<br />';

Example 711. Search Amazon Using the Query API

Here, we also search for PHP books at Amazon, but we instead use the Query API, which resembles the Fluent Interface design pattern.

= new Zend_Service_Amazon_Query('AMAZON_API_KEY',
$results $query->search();
foreach (
$results as $result) {
$result->Title '<br />';

Zend Framework