How to Structure a simple store using AES
Structuring a simple store with AES may sound difficult, 
but with some effort, it can be done.  Listen to suggestions 
by first-year affiliate Bryce Conner in the following article.

Simple Amazon Store Howto

This month, I'm going to be focusing on how to build your own Amazon Associate store using PHP and MySQL. It may be a lot of work at first, but the rewards seem to be well worth the effort.

Part 1: Getting to Know AES

  • Step 1: Sign up with Amazon E-Commerce Service and get your Access ID and Key.
  • Step 2:
  • It is important to become familiar at this point with how to get information with AES. We will be using PHP REST Requests, which require some knowledge of PHP and XML.

    Using REST

    The easiest way to get up and running is to use code snippets from SimpleStore.php that have been modified to work for you.

    (Read on to see sample code that will form the basis of the store...)

    The Request (continued)

  • You may use the following code snippet to process requests:
  • function request($request)
    {
             $session = curl_init($request);
             curl_setopt($session, CURLOPT_HEADER, false);
             curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
             $response = curl_exec($session);
             curl_close($session);
             return simplexml_load_string($response);
    }
    

    Nice function. But, where is the request? You can't call the function without a request, like this:

    define("KEYID", "your AES key id");  
    define("ASSOCIATE_TAG", "your associate tag");
    $xml = request("http://webservices.amazon.com/onca/xml"
       ."?Service=AWSECommerceService
       ."&AWSAccessKeyId=".KEYID
       ."&AssociateTag=".ASSOCIATE_TAG
       ."&Operation=ItemLookup"
       ."&ResponseGroup=Large,Images,Similarities,ItemAttributes
       .",Accessories,EditorialReview,Reviews"
       ."&ReviewSort=-HelpfulVotes&ItemId=".$ITEM_ASIN);
    

    This returns the SimpleXML Object for this request, which is actually quite lengthy, in terms of the response groups that you are receiving. What you are doing in this request is requesting item details by ASIN. To get the ASIN of an item you have to look it up. More on that later. The request returns features of the item, what items are similar to it, the image URLs of the item, what accessories go with the item, its editorial review, and the first page of user reviews.

    You'll want to store a request as large as this one in a database, because sometimes it takes several seconds to complete. Also, you are only allowed to make 1 request per second, which is another reason you'll want to cache the request in a database, or you'll receive a huge performance hit on your website, every time your page with that item is loaded.

    You are only allowed to cache requests for a certain length of time before renewing them. This is true because you must keep the prices updated for each item, within 24 hours.

    Next... How to Access the XML Object and store it into a database for future retreival...

    No one has commented on this article.
    Please keep your comments brief and on topic, and remember that this is not a discussion thread.
    Name : Title :
    Comment(s) :
    J! Reactions Commenting Software
    General Site License
    Copyright © 2006 S. A. DeCaro