Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Create an Amazon storefront using PHP, Part 1: Getting content with Amazon ECS

How to build a storefront and display its wares

Tyler Anderson (tyleranderson5@yahoo.com), Freelance Writer, Stexar Corp.
Tyler Anderson graduated with a degree in computer science from Brigham Young University in 2004 and is currently in his last semester as a master's student in computer engineering. In the past, he worked as a database programmer for DPMG.com, and he is currently an engineer for Stexar Corp., based in Beaverton, Ore.

Summary:  This is the first of a two-part tutorial titled "Create an Amazon storefront using PHP" that constructs an Amazon storefront using PHP and the Amazon E-Commerce Service (ECS). The storefront constructed will allow shoppers to view items displayed in lists or search for specific items in the store. Part 2 will cover the shopping cart, recommendation service, and constructing a collectibles shop.

View more content in this series

Date:  25 Oct 2005
Level:  Intermediate PDF:  A4 and Letter (1164 KB | 39 pages)Get Adobe® Reader®

Activity:  18226 views
Comments:  

Before you start

This tutorial is for programmers interested in creating a storefront that automates the process of connecting to Amazon Web Services and displaying the result using PHP. This assumes you are familiar with basic PHP concepts, including for and while loops, and form handling. If you are uncertain of your PHP prowess, there are great tutorials available to help you get up to speed (see Resources).

You should be familiar with Amazon Web Services, which are introduced in the developerWorks series "Boost application development with Amazon Web Services" (see Resources).

About this series

In this two-part series, we create an Amazon shopping cart with PHP. Part 1 will cover the storefront architecture, displaying selections and browsing categories by communicating to Amazon Web Services through item search requests. We will also create a search box.

Part 2 will cover creating, adding to, and modifying a shopping cart that will be stored entirely on Amazon servers using a technique called cart requests. We will cover building a collectibles shop and giving shoppers the ability to browse for similar items.


About this tutorial

We will build an Amazon storefront containing category links and a search box, allowing shoppers to browse categories in your store. Unlike most PHP applications, this one requires no local database, as data is stored on Amazon's servers. Therefore, this tutorial relies heavily on the Simple Object Access Protocol (SOAP), a Web services protocol that organizes information in XML. Web services is the way in which applications, like the PHP application you will build throughout this tutorial, communicate with central servers to obtain information.

Through the Amazon E-Commerce Service (ECS), you will obtain and display content from categories that shoppers choose. When a category is selected, you will create parameters indicating that category, collect other relevant information, and launch a SOAP client. The SOAP client will take the parameters, form an XML document, and relay the XML document to the SOAP server. The Amazon server accesses its databases to create an XML document containing items that match the criteria. Finally, the server returns an XML document to your SOAP client, which parses it into a data structure from which you extract the requested data.


Prerequisites

To follow along with this tutorial, you will need to install and test the following tools, and retrieve two identifiers from Amazon:

Web server
Pick any Web server and operating system. Feel free to use Apache V2.X, or the IBM HTTP Server.
PHP
You can follow along in this tutorial without PHP, but if you are interested in interacting with the sample application, download PHP V5. Make sure to build PHP with --enable-soap to enable the PHP SOAP extensions.
Amazon
You need two things from Amazon: a developer token and an Amazon Associates ID (see Resources).
Web Browser
You need a Web browser. These include Mozilla, Firefox, Opera, and Microsoft® Internet Explorer.

1 of 11 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source, SOA and Web services
ArticleID=133233
TutorialTitle=Create an Amazon storefront using PHP, Part 1: Getting content with Amazon ECS
publish-date=10252005
author1-email=tyleranderson5@yahoo.com
author1-email-cc=troy@backstopmedia.com