Forum Moderators: buckworks

Message Too Old, No Replies

Simple Amazon Web Services (AWS) script?

I'm looking for a simple (prefer PHP) but good AWS script

         

majjk

9:51 pm on Sep 14, 2004 (gmt 0)

10+ Year Member



I'm looking for a simple but good Amazon Web Services (AWS) script (I would prefer php), so that I with xml can display product information on my site. I have been looking around a bit, but so far the scripts have been either way too complex (I'd like to personalize it to fit my needs, and I'm no php expert, so it can't be too...) or it featured only some kind of best-seller selection and a search thingie. I have to be able to specify my own products (via ASIN numbers) - that is the most important thing. Also, I would prefer a free one.

Any ideas?

figment88

10:13 pm on Sep 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A lot depends on how busy your site is and if you want to display price and/or availability. If you meet these conditions, you will need a fairly complex script that caches results so you do not continually poll the AWS.

Most sites where I run AWS, I do not display price/availability so I can process offline and store info in a database. My sites then draw from a database to generate the pages.

Most AWS scripts have two parts. The first just forms the URL, does a fopen() or fsocketopen(), and get the AWS response. The scripts I've seen oftne overcomplicate this part especially if you are processing offline. You can just go to the XML scratchpad that Amazon provides (http://www.amazon.com/gp/browse.html/ref=sc_bb_l_3/002-0223769-9004826?%5Fencoding=UTF8&node=3427431&no=3427431&me=A36L942TSJ2AJA)
see the format of the URL's and make your own.

The second part of the AWS scripts just parses the returned XML. These are a great time-saver because they have all of the tags Amazon uses nested appropriately. You can mix-n-match the script that forms the URL and the one that parses it.

The XML parsers typically return a PHP array that you can do what you want with. The format as to capitalization and nesting varies, but you can just do a print_r() to see what you have to work with.