Before you start
This tutorial is for developers who want to learn about creating a
simple mashup, a web application that uses information from different sources. It uses the Zend Framework's
Zend_Services component and the principle of Representational State Transfer (REST) to demonstrate how to seamlessly include information to extra resources related to your feeds.
Using the examples of Amazon Web Services (AWS), Flickr Services, and Yahoo! Search Web services, and Twitter, this tutorial teaches you how to apply the PHP Zend Framework to quickly search those sites for relevant information. You will integrate this functionality into the Chomp feed reader developed in the previous parts of this series.
This series chronicles the building of an online feed reader, Chomp, while explaining all of the major aspects of using the recently introduced open source PHP Zend Framework.
Part 1 talked about the overall concepts of the Zend Framework, including a list of relevant classes and a general discussion of the MVC pattern. Part 2 expanded on that to show how MVC can be implemented in a Zend Framework application. You also created the user registration and login process, adding user information to the database and pulling it back out again.
Parts 3 and 4 deal with the actual RSS and Atom feeds. In Part 3, you enabled users to subscribe to individual feeds and to display the items listed in those feeds. You also learned about the Zend Framework's form-handling capabilities, validating data, and sanitizing feed items. Part 4 explained how to create a proxy to pull data from a site that has no feed.
The rest of the series involves adding value to the Chomp application.
Part 5 explained how to use the
Zend_PDF module to enable the user to create a customized PDF of saved articles, images, and search results. In Part 6, you used the
Zend_Mail module to alert users to new posts. In Part 7, you looked at searching saved content and returning ranked results. Here in Part 8, you will add an extra dimension to your feed reader by linking the online resources of Amazon.com, Yahoo!, Twitter and Flickr with your current application to create a robust mashup. And in Part 9, you will add Ajax to streamline the application and improve usability.
The process of providing links to related resources, or hyperlinking, is at the very core of the web. In fact, it is the very reason the web exists, and it's nothing new. However, what would previously need to be done by a human — searching the web for relevant resources, bookmarking URLs, and manually entering them into an article — can be easily automated when sites like Amazon and Yahoo! open up their sites using an application programming interface (API). APIs allow developers to access small snippets of information in a form other than a web page, most commonly with some type of XML. By automatically requesting a link to a book, you can dramatically increase the richness of your application without adding much overhead. Further, the Zend Framework's built-in APIs allows you to add relevant code in a few simple lines.
Like any good feed reader, Chomp provides the user with a collection of articles that are interesting. You can probably assume that if a feed mentions, say, a book related to a given article, the user would find that book interesting, as well. This tutorial seeks to give the user quick and easy access to this extra information by connecting directly to the Amazon.com developer's API and providing a link to the book on Amazon's site. Similarly, you can provide a link to a photo of an interesting location through Flickr, you can provide a link to Yahoo! news search results, or you could even search Twitter for the latest tweets.
This tutorial will cover:
REST-- Stateless vs. sessioned network interactions and how stateless interfaces can dramatically improve usability
- A quick overview of the Amazon Web Services interface
- Using the Zend Framework's
Zend_Service_Amazoncomponent to access Amazon
- Yahoo! Developer Network -- using the searching websites, news, and local results
- An overview of Flickr services, tagging, and using
Zend_Service_Flickrto search photos
- How to add Twitter results alongside the search results given when a feed search is performed
- Integrating the Yahoo! Developer Network with Chomp using the
- Adding all of this information to the Chomp interface
This tutorial assumes that you have a good familiarity with PHP programming. It would be helpful if you have a general familiarity with Amazon.com, Flickr, Twitter and Yahoo!, though you do not need to know much about these sites.
To follow along, you will need to have several pieces of software installed. This tutorial will cover installation and configuration, but make sure to download the following pieces of software. For detailed installation instructions on installing XAMPP and the Zend Framework, see Part 2.
- This is an easy-to-install version of Apache, MySQL, and PHP rolled into one package.
- AWS Access Key
- You need an Amazon Web Services access key.
- Yahoo! Application ID
- You need a Yahoo! Application ID, but first you need a Yahoo! username.