Source for file amazon_ecs4_itemsearch.php
Documentation is available at amazon_ecs4_itemsearch.php
// Example of usage for Services_AmazonECS4
require_once 'Services/AmazonECS4.php';
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<title>Services_AmazonECS4 example</title>
<h1>Amazon ECS4 example - ItemSearch Operation</h1>
<a href="http://www.amazon.com/gp/aws/sdk/" target="_blank">Amazon.com Help: Documentation</a><br />
<a href="http://www.amazon.com/gp/aws/sdk/main.html/?s=AWSEcommerceService&v=2005-07-26&p=ApiReference/ItemSearchOperation" target="_blank">Amazon ECS4.0 API Reference - ItemSearch Operation</a>
if (isset ($_GET['locale'])) {
$amazon->setLocale ($_GET['locale']);
if (!empty ($subid) && $subid != 'your ID here') {
foreach ($_GET as $k => $v) {
if ($k == 'subid' || $k == 'associd' || $k == 'locale') {
} else if ($k == 'SearchIndex') {
} else if ($k == 'ResponseGroup') {
foreach ($_GET['ResponseGroup'] as $v) {
if (isset ($ResponseGroup)) {
$ResponseGroup .= ',' . $v;
$options['ResponseGroup'] = $ResponseGroup;
$result = $amazon->ItemSearch ($search_index, $options);
// The list of all available search indexes can be found on the
// "Amazon ECS API Reference - Search Index Values"
// (http://www.amazon.com/gp/aws/sdk/main.html/?s=AWSEcommerceService&v=2005-07-26&p=ApiReference/SearchIndexValues).
$search_indexes = array ('Apparel', 'Baby', 'Beauty', 'Books', 'Classical', 'DigitalMusic',
'DVD', 'Electronics', 'ForeignBooks', 'GourmetFood', 'HealthPersonalCare',
'HomeGarden', 'Jewelry', 'Kitchen', 'Magazines', 'Merchants',
'Miscellaneous', 'Music', 'MusicalInstruments', 'MusicTracks',
'OfficeProducts', 'OutdoorLiving', 'PCHardware', 'PetSupplies',
'Photo', 'Restaurants', 'Software', 'SoftwareVideoGames',
'SportingGoods', 'Tools', 'Toys', 'VHS', 'Video', 'VideoGames',
'Wireless', 'WirelessAccessories', 'Blended');
<form action="{ $_SERVER['PHP_SELF']}" method="get">
$locales = array ('US', 'UK', 'DE', 'JP', 'FR', 'CA');
foreach($locales as $v) {
echo '<option value="' . $v . ($v == $_GET['locale'] ? '" selected="selected"' : '') . '">' . $v . '</option>';
<td>Subscription ID <input type="text" name="subid" value="{ $subid}" size="30" /></td>
<td>Associate ID <input type="text" name="associd" value="{ $_GET['associd']}" /></td>
Search Index <select name="SearchIndex">
foreach($search_indexes as $v) {
echo '<option value="' . $v . ($v == $_GET['SearchIndex'] ? '" selected="selected"' : '') . '">' . $v . '</option>';
<td>Keywords <input type="text" name="Keywords" value="{ $_GET['Keywords']}" /></td>
<td>Title<br/><input type="text" name="Title" value="{ $_GET['Title']}" /></td>
<td>Artist<br/><input type="text" name="Artist" value="{ $_GET['Artist']}" /></td>
<td>Author<br/><input type="text" name="Author" value="{ $_GET['Author']}" /></td>
<td>Actor<br/><input type="text" name="Actor" value="{ $_GET['Actor']}" /></td>
<td>Director<br/><input type="text" name="Director" value="{ $_GET['Director']}" /></td>
<td>Manufacturer<br/><input type="text" name="Manufacturer" value="{ $_GET['Manufacturer']}" /></td>
<td>MusicLabel<br/><input type="text" name="MusicLabel" value="{ $_GET['MusicLabel']}" /></td>
<td>Composer<br/><input type="text" name="Composer" value="{ $_GET['Composer']}" /></td>
<td>Publisher<br/><input type="text" name="Publisher" value="{ $_GET['Publisher']}" /></td>
<td>Brand<br/><input type="text" name="Brand" value="{ $_GET['Brand']}" /></td>
<td>Conductor<br/><input type="text" name="Conductor" value="{ $_GET['Conductor']}" /></td>
<td>Orchestra<br/><input type="text" name="Orchestra" value="{ $_GET['Orchestra']}" /></td>
<td>Power <input type="text" name="Power" value="{ $_GET['Power']}" size="80" /></td>
<td>BrowseNode <input type="text" name="BrowseNode" value="{ $_GET['BrowseNode']}" /></td>
<td>AudienceRating <input type="text" name="AudienceRating" value="{ $_GET['AudienceRating']}" /></td>
<textarea name="TextStream" cols="64" rows="4">{ $_GET['TextStream']}</textarea>
<td>ItemPage <input type="text" name="ItemPage" value="{ $_GET['ItemPage']}" /></td>
<td>Sort <input type="text" name="Sort" value="{ $_GET['Sort']}" /></td>
<td>MinimumPrice <input type="text" name="MinimumPrice" value="{ $_GET['MinimumPrice']}" /></td>
<td>MaximumPrice <input type="text" name="MaximumPrice" value="{ $_GET['MaximumPrice']}" /></td>
<select name="Condition">
$conditions = array ('', 'New', 'All', 'Used', 'Refurbished', 'Collectible');
foreach ($conditions as $v) {
echo '<option value="' . $v . ($v == $_GET['Condition'] ? '" selected="selected"' : '') . '">' . $v . '</option>';
$response_groups = array ('Request', 'ItemIds', 'Small', 'Medium', 'Large', 'OfferFull', 'Offers',
'OfferSummary', 'Variations', 'VariationMinimum', 'VariationSummary',
'ItemAttributes', 'Tracks', 'Accessories', 'EditorialReview',
'SalesRank', 'BrowseNodes', 'Images', 'Similarities', 'ListmaniaLists',
'SearchBins', 'Subjects');
foreach ($response_groups as $v) {
echo '<input type="checkbox" name="ResponseGroup[]" value="' . $v . '" ' . (@in_array($v, $_GET['ResponseGroup']) ? 'checked="checked"' : '') . '/>' . $v . ' ';
<td><input type="submit" value="Search" /></td>
<td><a href="{ $_SERVER['PHP_SELF']}?subid={ $_GET['subid']}&SearchIndex=Books&Keywords=php&ResponseGroup%5B%5D=Request&ResponseGroup%5B%5D=Small">Keywords</a></td>
<td><a href="{ $_SERVER['PHP_SELF']}?subid={ $_GET['subid']}&SearchIndex=Books&Keywords=php&ItemPage=2&ResponseGroup%5B%5D=Request&ResponseGroup%5B%5D=Medium">ItemPage</a></td>
<td><a href="{ $_SERVER['PHP_SELF']}?subid={ $_GET['subid']}&SearchIndex=Blended&Keywords=teletubbies&ResponseGroup%5B%5D=Request&ResponseGroup%5B%5D=Small">Blended</a></td>
<td><a href="{ $_SERVER['PHP_SELF']}?subid={ $_GET['subid']}&SearchIndex=Books&Power=%28subject%3A+sushi+or+pizza%29+and+pubdate%3A+after+2000&ResponseGroup%5B%5D=Request&ResponseGroup%5B%5D=ItemAttributes">Power</a></td>
<td><a href="{ $_SERVER['PHP_SELF']}?subid={ $_GET['subid']}&SearchIndex=Electronics&BrowseNode=595046&ResponseGroup%5B%5D=Request&ResponseGroup%5B%5D=Small&ResponseGroup%5B%5D=ItemAttributes">BrowseNode</a></td>
<td><a href="{ $_SERVER['PHP_SELF']}?subid={ $_GET['subid']}&SearchIndex=Electronics&BrowseNode=301187&Sort=salesrank&ResponseGroup%5B%5D=Request&ResponseGroup%5B%5D=ItemAttributes">Sort</a></td>
<td><a href="{ $_SERVER['PHP_SELF']}?subid={ $_GET['subid']}&SearchIndex=Books&Keywords=programming&MinimumPrice=5000&MaximumPrice=10000&ResponseGroup%5B%5D=Request&ResponseGroup%5B%5D=Small&ResponseGroup%5B%5D=OfferSummary">Price</a></td>
<td><a href="{ $_SERVER['PHP_SELF']}?subid={ $_GET['subid']}&SearchIndex=DVD&AudienceRating=PG-13&ResponseGroup%5B%5D=Request&ResponseGroup%5B%5D=ItemAttributes">AudienceRating</a></td>
$lasturl = $amazon->getLastUrl ();
echo '<p>REST request:<br/>';
echo '<a href="' . $lasturl . '" target="_blank">' . ereg_replace('&', '<br/>&', $lasturl) . '</a></p>';
if (PEAR ::isError ($result)) {
echo '<p>Processing Time: ' . $amazon->getProcessingTime () . 'sec</p>';
Documentation generated on Mon, 11 Mar 2019 14:13:44 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|