Amazon API: Product Category

The following script works well for retrieving information about books from the Amazon API.

However it does NOT work for other Amazon items such as electronics, movies, or toys.

Could someone please help me find a way to make it work with other categories?
Thanks!
amazon.php.txt
LVL 16
hankknightAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

James LooneySr. Programmer/AnalystCommented:
You want to change the values (or create a form to put in your own values) that get set in lines 297 - 307. Also change the values in the Adefault array in lines 215 - 226.

See "Search Index" below, I changed to Music and it now pulls CDs that have to do with "Machiavelli"

//form the URL to send to Amazon as a search request
$file="http://webservices.amazon.com/onca/xml?".
      'Service'       .'='.'AWSECommerceService'   .'&'.  //this makes it version 4
      'SubscriptionId'.'='.$subscriptionid         .'&'.  //is this correct?
      'Operation'     .'='.'ItemSearch'            .'&'.  //20080530: please note that $searchtype is not used here anymore!
//    'Operation'     .'='.$searchtype             .'&'.
      'Keywords'      .'='.urlencode($search)      .'&'.
      'SearchIndex'   .'='.'Music'                 .'&'.  //or Restaurants
      'ItemPage'      .'='.$page                   .'&'.
      'AssociateTag'  .'='.$Aassociates_id[$locale].'&'.
      'ResponseGroup' .'='.'Medium'                ;      //or Large

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.