A2S Simple Store with Request Signing in PHP
This is a simple PHP 5 application demonstrating the basics of how to interact with Amazon Associates Web Service (A2S, formerly known as ECS).
This sample is based on the Amazon A2S Simple Store PHP script, which stopped working when Amazon started requiring cryptographic signatures on Amazon API requests.
This version of the SimpleStore script is (c) 2016 Franklin Veaux, licensed under the Apache 2.0 license. You are free to use, modify, redistribute, create derivative works, and generally do whatever else you want as long as this notice remains intact.
About This Sample
- This application is meant to demonstrate the ItemSearch, ItemLookup, CartCreate, CartAdd, and CartModify operations. It is not intended to be be comprehensive example of how to build an e-commerce store. For example, on an ItemSearch by Keywords, this sample only returns items that are for sale by Amazon (as opposed to other Merchants).
- This sample was tested on PHP 5.1.4.
What's New
- 2007-04-06: This sample now presents a "See Cart Contents" link when items are in the shoppers cart. Previously, a shopper could only see cart contents upon adding an item to the cart.
- 2016-04-06: (Franklin Veaux) This sample has been updated to include code signatures, hardened against security exploits, and other bugs have been fixed. Additional debugging is available in the code; see code comments for more.
Prerequisites
- You must have a valid Amazon Web Services developer account. (You can create one here: http://aws.amazon.com)
Running the Sample
- Replace [Your Amazon Access Key ID] wih your AWS Access Key Id in the simplestore.php file
- Replace [Your Amazon Secret Access Key] wih your AWS Secret Key in the simplestore.php file.
- Replace [Your Amazon Associates ID] with your Associate Tag in the simplestore.php file
- To run the sample, put SimpleStore.php in your root directrory and load SimpleStore.php in your browser.