March 4, 2021
Hot Topics:

Amazon Web Services and the Zend Framework

  • By Jason Gilmore
  • Send Email »
  • More Articles »

This list underscores a very important point to keep in mind when using Amazon's Web Service. Video game aficionados will quickly realize this isn't a complete list of all known games containing the term "Mario" in the title. This is because Amazon's database isn't a video game archive!! Rather, it's simply a catalog of all products currently sold on Amazon.com. Therefore, you cannot rely upon it to provide you with every product ever made, and instead will need to create additional tools for manually adding product information to your own database in the case it's not found on Amazon.com.

Displaying Product Images

Chances are you'll want to display a product image alongside any other relevant product image. Amazon provides you with access to these images by way of a URL. To retrieve the image, set the response grouping to "Large" when searching, and subsequently refer to the SmallImage->Url, MediumImage->Url, and LargeImage->Url attributes, respectively. Because these values point directly to the image, you'll need to embed them within an <img> tag:

<img src='{$game->MediumImage->Url}' />

On GameNomad, I use a similar approach to render all of the video game covers, as shown in Figure 1:

Click here for a larger image.

Figure 1: Retrieving video game covers using Amazon Web Services

Using the Alternative Query API

The Zend_Service_Amazon component also supports a second method for querying Amazon's Web service, known as the Query API. This method streamlines the code otherwise required to interact with the Web service. An example follows:

$query = new Zend_Service_Amazon_Query($this->config->
$games = $query->search();
foreach ($games AS $game) {
   echo "{$game->Title}<br />";

This code produces a result identical to that used to perform the earlier title search. Because the ultimate outcome is identical no matter the approach, the method you choose is merely a matter of preference. Personally, I prefer the alternative query API because it seems to produce more legible code, but the choice is ultimately yours.

Where to From Here?

Sending email from your PHP-powered websites is easy once you've been provided with the necessary background, so hopefully this tutorial helped alleviate any initial confusion you had in this regards. For further information, check out the following resources for more information about sending email using PHP:

About the Author

Jason Gilmore is founder of a Web development and consulting firm based out of Columbus, Ohio. Formerly Apress' open source editor, Jason fostered the development of more than 60 books, along the way helping to transform their open source line into one of the industry's most respected publishing programs. He's the author of several books, including the best-selling Beginning PHP and MySQL: From Novice to Professional (currently in its third edition), Beginning PHP and PostgreSQL: From Novice to Professional, and Beginning PHP and Oracle: From Novice to Professional.

Jason is cofounder of CodeMash, a nonprofit organization tasked with hosting an annual namesake developer's conference, and was a member of the 2008 MySQL Conference speaker selection board. Jason has over 100 articles to his credit within prominent publications such as Developer.com, Linux Magazine, and TechTarget.

Page 2 of 2

This article was originally published on November 24, 2008

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date