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 developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

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:  13286 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



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

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

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.