Zend_Service_Amazon_Query provides an alternative
API for using the Amazon Web Service. The alternative
API uses the Fluent Interface pattern. That is, all calls can be
made using chained method calls. (e.g., $obj->method()->method2($arg))
The Zend_Service_Amazon_Query API uses
overloading to easily set up an item search and then allows you to search based upon
the criteria specified. Each of the options is provided as a method call, and each
method's argument corresponds to the named option's value:
Example 698. Search Amazon Using the Alternative Query API
In this example, the alternative query API is used as a fluent interface to specify options and their respective values:
<?php
$query = new Zend_Service_Amazon_Query('MY_API_KEY', 'US', 'AMAZON_SECRET_KEY');
$query->Category('Books')->Keywords('PHP');
$results = $query->search();
foreach ($results as $result) {
echo $result->Title . '<br />';
}
This sets the option Category to "Books" and Keywords
to "PHP".
For more information on the available options, please refer to the relevant Amazon documentation.




