From:

Book Review: Packt’s “PHP Web 2.0 Mashup Projects”

I recently received a great little book from Packt Publishing that’s a bit out of the norm for some of the PHP-related books these days. A lot of them tends to rehash the same details over and over again or focus too tightly on one particular aspect of the language to get much value from a wide audience range. This new book (PHP Web 2.0 Mashup Projects), however, takes PHP and applies it to one of the more popular topics of the times - mashups - and, via five difference projects, shows how to make your code place nice with the outside world.

Shu-Wai Chow introduces mashups first by talking about the importance of the sharing of data on the web and some of the methods that they will use to create the mashups in the book. From there, it’s all about the examples and their technologies:

  • Buy it on Amazon- creating a simple application that uses Amazon’s API, XML-RPC, the REST protocol and the Internet UPC database’s API to find information and pricing for the items matching the user’s search term.
  • Make Your Own Search Engine- mixing together the MSN search API via SOAP requests and responses to get the information for a user’s search.
  • You own Video Jukebox(my personal favorite) - a mashup of the YouTube and Last.fm APIs to pull the song information and videos for the titles in the feed (in either XSPF, RSS or YouTube’s XML format).
  • Traffic Incidents Via SMS- Scraping the California Highway Patrol’s website, they combine this data with the interface from 411Sync.com to send SMS updates to users of the system when new accidents arise.
  • London Tube Photos- a huge chapter crammed full of information and different mashup components including Google Maps, Flickr, SPARQL, the RDF API for PHP, using the XMLHttpRequest object in Javascript (along with JSON) to create a system that allows the viewer to locate images of the London Tube based on a location on a map rather than just a description on the site.

My personal favorite of the mashups is (as mentioned) the Video Jukebox one - I just think it’s a cool idea to be able to bring those two things together pretty easily thanks to two of the most powerful APIs out there.

Even if you’re not into the mashup aspect of the book, but you are a budding SOAP developer looking for a few helpful hints when it comes to WSDL structure, you’d do well to pick up a copy too. In Chapter 3, he’s written up a great little primer to the structure of a WSDL document (types, message, portType, etc) and has made it simple enough for just about anyone to catch. I know when I was starting out with SOAP, this was the one thing that I could definitely have used. Plus, without a built-in method for PHP5’s SOAP extension to make the WSDL for you, this can help you bridge the gap.

Overall, it’s a great book - a definite purchase for anyone out there looking to see how to combine two or more web services into one seamless application. Plus it gives a great overview of a lot of handy web service type bits of functionality.



Related Articles

Relatd Projects

Facebook API

This JavaScript client library allows you to make Facebook API calls from any web site and makes it easy to create Ajax Facebook applications. Since the library does not require any server-side code on your server, you can now create a Facebook application that can be hosted on any web site that serves static HTML. An application that uses this client library should be registered as an iframe type. This applies to either iframe Facebook apps that users access through the Facebook web site or apps that users access directly on the app’s own web sites. Almost all Facebook APIs are supported.

script.aculo.us
script.aculo.us provides you with easy-to-use, cross-browser user interface JavaScript libraries to make your web sites and web applications fly.
newjs

A simple command-line tool to create the folders and helper files for a new JavaScript project/library. As a bonus, you can quickly create a website to promote your project.

When you start a new JavaScript library, how do you layout the source files, the tests, the distribution files? Do you have support scripts to generate distributions from source files? Run your JavaScript unit tests? Generators to create new unit test HTMLfiles?

jQuery
jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.
mapper.js
mapper.js 1.2 allows you to add automatic area highlighting to image maps on your webpages (inc. export to SVG). It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, Safari and IE6+. On older browsers, it can use "jsgraphics" from Walter Zorn (if installed), else it'll degrade and your visitors won't notice a thing.
GWT(Google Web Toolkit)

Google Web Toolkit (GWT) is an open source Java software development framework that makes writing AJAX applications like Google Mapsand Gmaileasy for developers who don't speak browser quirks as a second language. Writing dynamic web applications today is a tedious and error-prone process; you spend 90% of your time working around subtle incompatibilities between web browsers and platforms, and JavaScript's lack of modularity makes sharing, testing, and reusing AJAX components difficult and fragile.

GWT lets you avoid many of these headaches while offering your users the same dynamic, standards-compliant experience. You write your front end in the Javaprogramming language, and the GWT compiler converts your Java classes to browser-compliant JavaScript and HTML.

google caja

Using Caja, web apps can safely allow scripts in third party content.
The computer industry has only one significant success enabling documents to carry active content safely: scripts in web pages. Normal users regularly browse untrusted sites with Javascript turned on. Modulo browser bugs and phishing, they mostly remain safe. But even though web apps build on this success, they fail to provide its power. Web apps generally remove scripts from third party content, reducing content to passive data. Examples include webmail, groups, blogs, chat, docs and spreadsheets, wikis, and more.
Were scripts in an object-capability language, web apps could provide active content safely, simply, and flexibly. Surprisingly, this is possible within existing web standards. Caja represents our discovery that a subset of Javascript is an object-capability language

AJAXInterceptor
Project Description
Just by adding this small JavaScript module to the end of your web pages, you get your form's submissions intercepted and, instead of sending request to the server in the usual way, they are done asynchronously and in an AJAX-style smooth way.

As long as it is a client-side library it will work with any server technology: ASP.NET, PHP, JSP, Classic ASP... and even with local HTM files.

I've included extensibility so that you can add easily your own progress indicators (several included) and show error messages the way you prefer (by default it shows an alert).

It's transparent to your server code and could be used to add AJAX capabilities to some applications without writting a single line of code.

Documentation is included.



Features summary

• No-code AJAXification of web apps
• Supports any server technology, including ASP.NET, JSP, PHP, ASP 3.0...
• In ASP.NET it supports all kinds of postbacks: direct and by code.
• Works in any modern browser that supports AJAX.
• Supports cross-posting of forms, that is, you can send the information to any web page in the same domain. If all your web pages have AJAXInterceptor included (for example, you include it in your master page or template) you can hace
• Respects your custom onsumit event handlers.
• Supports browser history so that your users can hit the previous button and get the last rendered page.
• Two versions of the module:
- AJAXInterceptor.js: full commented one. Useful for debugging purposes.
- AJAXINterceptor_r.js: reduced-size version. It downloads faster as it only is 2.6 kB in size. It's better to use this on production apps.
• Automatically show/hide custom progress indicators.
• Support for cancelling operations.
• Support for custom message displaying.
• Supports any form in your page

Obviously this is not substitute at all of full-fledged APIs like Microsoft's ASP.NET AJAX, PHPLiveX or AJAX.NET, but will let you add AJAX support to your apps in a few seconds and without writing any code. Just give it a try!

In the ZIP you will find teh module, a working sample with ASP.NET and a PDF with the help documentation.

This project is just for fun :-)

I will be very glad if you drop me a line in case you use AJAXInterceptor in any real-world application or if you enhance it with new features.

Visit my .NET blog (Spanish) at http://www.jasoft.organd my e-mail marketing blog (English) at http://www.theemailingexperience.com
Liberator
Liberator is the most performant and fully-featured server currently available for streaming real-time data to web pages. The technology behind many of the world's leading financial trading portals, it is now available FREE for evaluation and non-commercial use.
jQuery UI

jQuery UI is a set of themable widgets and interactions, built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications.