Mashups and PHP

A must-read book for all Czech web creators: Shu-Wai Chow PHP Web 2.0 Mashup Projects external, by Packt Publishing external

book
In this time Czech people-behind-the-web are holding big discussions about Web 2.0, solving issues such if the Web2.0 is based on the rounded corners and glossy colors or if it’s based on the communities. The Czech webzin Lupa has announced its „annual awards for the memorable Czech webs“ - with almost the same names like in the past year. The Czech data owners still develope strange methods and legal agreements against „the Data Thieves“... In this frowsty atmosphere a new book appears which can bring a fresh air in the Czech web. Yes, I’m talking about the „PHP Web2.0 Mashup Projects“ book, issued by Packt Publishing. You can buy it directly from the Packt web pages for 36 dollars (or 33 Euros, it’s pretty strange exchange, isn’t it?)

The book begins with a verbose introduction into the mashups’ world. The author says: „Web mashups are exactly what they sound like - web applications that merge data from one or more sources and present them in new ways. Very often, the data owners encourage and facilitate third parties to use the data. In many cases, this facilitation is made possible by the data owners providing application programming interfaces (API) to their data. These APIs follow standard web service protocols and can be implemented quickly and easily in a variety of programming languages, including PHP. (...) The question of who owned data and what they choose to do with the data became a big issue. Why in the world would companies invest millions of dollars to gather their data and their database systems, but then freely give it away for others to use? The answer is by opening their systems, mashup developers help increase the reach of the data owners.“

In the second chapter the author demonstrates the creation of the first mashup - Amazon and UPC database joint. The two often used protocols are demonstrated on this example mashup - XML-RPC and REST. The author describes the XML-RPC requests and responses a format in the very understandable and detailed way, interlaced with short pieces of PHP code. He also shows how to use XML-RPC class from the PEAR repository. In the next part there is the REST protocol described, in the same manner like XML-RPC (means „clearly and detailed explanation“), finished by the own REST client class and the own XML responses parser (via the SAX). In this moment everything is ready for introducing the UPC Database API and the Amazon AWS API. All necessary methods are introduced and described. In the last part of this chapter, named „Mashing Up“, all of this information is used to build an own mashup. This mashup takes an UPC/EAN code from the goods, looks for this code in the product database and tries to find that thing in the Amazon shops. If the searching is successfull, the picture of desired thing is showed (if available) and user can add it into the basket, fully automatically, by the API methods. In the book a well-documented source code is listed, but only the „necessary parts“, not the padding around.

The third chapter has a provocative title „Make your own search engine“. But don’t worry, it’s not the Google competitor. It’s the Microsoft’s and Yahoo’s search engines mashup. Do you remember the „meta-search-services“? This mashup looks exactly like them! In this chapter the author describes and demonstrates the SOAP interface usage (detailed and clearly again). In the Chapter Four we get a video jukebox. The idea of this video jukebox is simple - mashup takes the information about recently played songs from the Last.fm and looks for appropriate video clips on the YouTube. This mashup is built with the PEAR libraries and uses the REST protocol and the XML, XPSF and RSS formats. Anyway - this chapter is available from the web too, like the sample chapter (PDF) external

The fifth chapter shows a not-so-clean method for mashup data acquiring. It describes a mashup which informs the user about the highway accidents by SMS. The main problem is to get data from California Highway Patrol service (they behave like many of the Czech data owners), because their web doesn’t provide any usable way to get the data. So the author shows a technique called „screen scraping“, incumbent on grabbing HTML document, making DOM tree and picking required data. It’s a very interesting chapter.

The book ends with the sixth chapter, in which the author mashes up the Google Maps and the Flickr. His mashup shows the underground stations on the London map. The user can click on the marker of an concrete subway station and the mashup service provides photos of this station (from the Flickr). The main theme of this chapter is the REST protocol with the RDF and JSON data formats, using the tools like the SPARQL, RDF API for PHP or the loved AJAX. All of this is well explained again, freely flavored by the PHP code examples.

The resume is here. I’ll start with the negatives: On several code examples there are typographical quotation marks instead of proper „computer quotation marks“. I thought for a while about the meaning of the things such as $a=«String». I would also prefer a „live“ demonstration of the mashups described in the book, maybe on Packt web server.

But the positives predominate: The book is readable and well-arranged. The text is short enough to hold reader’s attention, but full of valuable information. A reader who knows how the REST or XML-RPC works can skip over relevant parts (or go through just for memory refreshing), nevertheless he finds a lot of interesting things in the book. The book is no „How To Make A Mashup - Step By Step“ instruction manual, so don’t expect you will write an amazing and superb mashup in the afternoon immediatelly after reading through. The most important thing for mashup creating is the idea WHAT and HOW mash up (the same problem which a barman must solve before mixing cocktails). The book is no step-by-step manual, as I have already mentioned. It provides an overview of API’s possibilities, it shows methods „how-to“ and, last but not least, inspires one to its own activity!

So, it has inspired at least me. I must say this book was the last impulse making me to provide the ApiMania website (the list of the Czech and Slovak APIs and mashups).

I hope it will inspirate others too...


Reklama AdSense

Powered by Drupal - Design by artinet