PHP Web 2.0 Mashup Projects: Practical PHP Mashups with Google Maps, Flickr, Amazon, YouTube, MSN Search, Yahoo!


PHP Web 2.0 Mashup Projects: Practical PHP Mashups with Google Maps, Flickr, Amazon, YouTube, MSN Search, Yahoo!
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
$13.19
save 45%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
$39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  •     Expand your website and applications using mashups
  •     Gain a thorough understanding of mashup fundamentals
  •     Clear, detailed walk-through of the key PHP mashup building technologies
  •     Five fully implemented example mashups with full code

 

Book Details

Language : English
Paperback : 304 pages [ 235mm x 191mm ]
Release Date : September 2007
ISBN : 184719088X
ISBN 13 : 9781847190888
Author(s) : Shu-Wai Chow
Topics and Technologies : All Books, Web Development, AJAX, Open Source, PHP, Web Development


Table of Contents

Preface
Chapter 1: Introduction to Mashups
Chapter 2: Buy it on Amazon
Chapter 3: Make Your Own Search Engine
Chapter 4: Your Own Video Jukebox
Chapter 5: Traffic Incidents via SMS
Chapter 6: London Tube Photos
Index
  • Chapter 2: Buy it on Amazon
    • Project Overview
    • XML-RPC
      • XML-RPC Structure
        • XML-RPC Request
        • Arrays
        • Struct
      • XML-RPC Response
    • Working with XML-RPC in PHP
      • Making an XML-RPC Request
        • Serializing Data with XML-RPC Encode Request
        • Calling XML-RPC Using Sockets
    • Processing an XML-RPC Response
      • Creating an XML-RPC Parser Class
        • Testing Our XML-RPC Parser Class
      • Using PEAR to Handle XML-RPC
    • REST
    • Working with REST in PHP
      • Making a REST Request
        • A GET and POST Refresher
        • Using Sockets to Initiate a REST Request
        • Creating GET and POST Request Functions
        • Making a REST Parser Class
        • Testing Our REST Parser Class
      • Processing a REST Response
        • Basic Walkthrough with PHP and SAX
        • Creating a SAX Parser Class
    • Internet UPC Database API
    • Amazon API
      • A Tour of ECS
      • Anatomy of an ECS REST Request
        • Location of Service
    • Mashing Up
      • Product Lookups
        • Handling Amazon's XML Responses
    • Summary
  • Chapter 3: Make Your Own Search Engine
    • Project Overview
    • SOAP
      • Web Services Descriptor Language (WSDL) With XML Schema Data (XSD)
        • Basic WSDL Structure
        • definitions Element
        • types Element
        • message Element
        • portType Element
        • binding Element
        • service Element
      • The SOAP Message
        • Envelope
        • Header
        • Body
        • Fault
    • PHP's SoapClient
      • Creating Parameters
      • Instantiate the SoapClient
        • Instantiating in WSDL Mode
        • Instantiating in Non-WSDL Mode
      • Making the Call and Using SoapClient Methods
      • Handling the SOAP Response
    • Microsoft Live Search Web Service
      • Using Search
    • Yahoo! Search Web Service
      • Using Web Search
    • Mashing Up
    • Summary
  • Chapter 4: Your Own Video Jukebox
    • Project Overview
    • XSPF
    • RSS
    • YouTube Overview
      • YouTube Developer API
    • Last.fm Overview
      • Audioscrobbler Web Services
    • Parsing With PEAR
      • Package Installation and Usage
      • File_XSPF
      • Services_YouTube
      • XML_RSS
    • Mashing Up
      • Mashup Architecture
      • Main Page
      • Navigation Page
      • Content Page
      • Using the Mashup
    • Summary
  • Chapter 5: Traffic Incidents via SMS
    • Project Overview
    • Screen Scraping the PHP Way
      • Parsing with DOM Functions
        • Basic Element and Attribute Parsing
        • Testing the Schema
        • More About PHP's Implementation of the DOM
    • 411Sync.com API
      • Creating Your Mobile Search Keyword
        • Name Your Keyword
        • Format the Users will Use when They Use Your Search
        • HTTP Location of the XML Data
    • California Highway Patrol Incident Page
    • Mashing Up
      • The Incident Class
      • The DOM Parser Class
      • The CHP DOM Parser Class
      • Creating the Feed Page
      • Testing and Deploying
    • Summary
  • Chapter 6: London Tube Photos
    • Project Overview
    • Preliminary Planning
    • Finding Tube Information
    • Integrating Google Maps and Flickr Services
    • Application Sequence
    • Resource Description Framework (RDF)
    • SPARQL
      • Analyzing the Query Subject
      • Anatomy of a SPARQL Query
      • Writing SPARQL WHERE Clauses
        • Basic Principles
        • A Simple Query
        • Querying for Types
        • Ordering, Limiting, and Offsetting
        • UNION and DISTINCT
      • More SPARQL Features
    • RDF API for PHP (RAP)
    • XMLHttpRequest Object
      • XMLHttpRequest Object Overview
      • Using the Object
        • Creating the Object
        • Making the HTTP Request
        • Creating and Using the Callback
    • JavaScript Object Notation (JSON)
      • JavaScript Objects Review
      • JSON Structure
      • Accessing JSON Properties
      • Serializing the JSON Response
    • Google Maps API
      • Creating a Map
      • Geocoding
      • Markers
      • Events
      • InfoWindow Box
    • Flickr Services API
      • Executing a Search
      • Interpreting Service Results
      • Retrieving a Photo or a Photo's Page
    • Mashing Up
      • Building and Populating the Database
        • Examining the File
        • Creating Our Database Schema
        • Building SPARQL Queries
        • Stations Query
        • Lines Query
        • Lines to Stations Query
        • Database Population Script
      • The TubeSource Database Interface Class
      • The Main User Interface
      • Using Flickr Services with AJAX
        • Creating an XMLHttpRequest Proxy
        • Modifying the Main JavaScript
        • Making the XMLHttpRequest
        • Race Conditions
        • Parsing the AJAX Response
    • Summary

Shu-Wai Chow

Shu-Wai Chow has worked in computer programming and information technology for the past eight years. He started his career in Sacramento, California, spending four years as the webmaster for Educaid, a First Union Company, and another four years at Vision Service Plan as an application developer. Through the years, he has become proficient in Java, JSP, PHP, ColdFusion, ASP, LDAP, XSLT, and XSL-FO. Shu has also been the volunteer webmaster and a feline adoption counselor for several animal welfare organizations in Sacramento.

He is currently a software engineer at Antenna Software in Jersey City, New Jersey, and is finishing his studies in Economics at Rutgers, the State University of New Jersey.

Born in the British Crown Colony of Hong Kong, Shu did most of his alleged growing up in Palo Alto, California. He lives on the Jersey Shore with seven very demanding cats, four birds that are too smart for their own good, a tail-less bearded dragon, a betta who needs her tank cleaned, a dermestid beetle colony, a cherished Fender Stratocaster, and a beloved, saint-like fiancé.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 6 submitted: last submission 10 Sep 2012

Errata type: Typo | Page number: 36

In the book there is what looks like a dash versus an underscore in pear install XML-RPC it should be: pear install XML_RPC

 

Errata type: Code | Page number: 27

Passing Arrays in XML-RPC Requests. Code example: $requestMessage = xmlrpc_encode_request('theRemoteCall', $listArray); Does not give the required result. I believe the correct code should be: $requestMessage = xmlrpc_encode_request('theRemoteCall', array($listArray)); Note the addition of the extra array() cast.

 

Errata type: Code | Page number: 27

In the second example on p.27 entitled "Passing Struct in XML-RPC Requests" there is a missing closing quote(") after "true array("One" => "This is a string", "Two" => "true, "This is a name" => -98.33) should be: array("One" => "This is a string", "Two" => "true", "This is a name" => -98.33)

 

Errata type: Code | Page number: 46

It is given: echo $parser->callService($params1, 'localhost', '/addiction/ch1/examples/RESTService.php', 'POST'); echo " it should be: echo $parser->callService($params2, 'localhost', '/addiction/ch1/examples/RESTService.php', 'GET'); as "/addiction/ch1/" does not exist

 

Errata type: Code | Page number: 27 | Errata date: 18 Dec 08

The code snippet for the "Passing Arrays in XML-RPC Requests" paragraph seems to be missing the array keyword for the 2nd argument of the xmlrpc_encode_request function. it should be: $requestMessage = xmlrpc_encode_request('theRemoteCall', array($listArray));

 

Errata type: Code | Page number: 27

In the example of "Passing Arrays in XML-RPC Requests" you miss an additional array($listArray) in the call: $requestMessage = xmlrpc_encode_request('theRemoteCall', $listArray);

 

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

PHP Web 2.0 Mashup Projects: Practical PHP Mashups with Google Maps, Flickr, Amazon, YouTube, MSN Search, Yahoo! +    Building Powerful and Robust Websites with Drupal 6 =
50% Off
the second eBook
Price for both: $28.20

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

You will learn how to write PHP code to remotely consume services like Google Maps, Flickr, Amazon, YouTube, MSN Search, Yahoo!, Last.fm, and the Internet UPC Database, not to mention the California Highway Patrol Traffic data! You will also learn about the technologies, data formats, and protocols needed to use these web services and APIs, and some of the freely-available PHP tools for working with them.
You will understand how these technologies work with each other and see how to use this information, in combination with your imagination, to build your own cutting-edge websites.

Chapter 1 provides an overview of "mashups": what a mashup is, and why you would want one.

In Chapter 2 we create a basic mashup, and go shopping. We will simply look up products on Amazon.com based on the Universal Product Code (UPC). To do this, we cover two basic web services to get our feet wet — XML-RPC and REST. The Internet UPC Database is an XML-RPC-based service. while Amazon uses REST.  We will create code to call XML-RPC and REST services. Using PHP’s SAX function, we create an extensible object-oriented parser for XML. The mashup covered in this chapter integrates information taken from Amazon's e-commerce service (ECS) with the Internet UPC database.

In Chapter 3, we create a custom search engine using the technology of MSN, and Yahoo! The chapter starts with an introduction to SOAP, the most complex of the web service protocols.  SOAP relies heavily on other standards like WSDL and XSD, which are also covered in readable detail.  We take a look at a WSDL document and learn how to figure out what web services are available from it, and what types of data are passed.  Using PHP5’s SoapClient extension, we then interact with SOAP servers to grab data. We then finally create our mashup, which gathers web search results sourced from MSN and Yahoo!

For the mashup in Chapter 4, we use the API from the video repository site YouTube, and the XML feeds from social music site Last.fm.  We will take a look at three different XML-based file formats from those two sites: XSPF for song playlists, RSS for publishing frequently updated information, and YouTube’s custom XML format.  We will create a mashup that takes the songs in two Last.fm RSS feeds and queries YouTube to retrieve videos for those songs. Rather than creating our own XML-based parsers to parse the three formats, we have used parsers from PEAR, one for each of the three formats.  Using these PEAR packages, we create an object-oriented abstraction of these formats, which can be consumed by our mashup application.

In Chapter 5, we screen-scrape from the California Highway Patrol. The CHP maintains a website of traffic incidents. This site auto-refreshes every minute, ensuring the user gets live data about accidents throughout the state of California. This is very valuable if you are in front of a computer. If you are out and about running errands, it would be fairly useless. However, our mashup will use the web service from 411Sync.com to accept SMS messages from mobile users to deliver these traffic incidents to users.

We've thrown almost everything into Chapter 6! In this chapter, we use RDF documents SPARQL, RAP, Google Maps, Flickr, AJAX, and JSON. We create a geographically-centric way to present pictures from Flickr on Google Maps. We see how to read RDF documents and how to extract data from them using SPARQL and RAP for RDF. This gets us the latitude and longitude of London Tube Stations. We display them on a Google Map, and retrieve pictures of a selected station from Flickr. Our application needs to communicate with the API servers for which we use AJAX and JSON, which is emerging as a major data format. The biggest pitfall in this AJAX application is race conditions, and we will learn various techniques to overcome these.

In Detail

A mashup is a web page or application that combines data from two or more external online sources into an integrated experience. This book is your entryway to the world of mashups and Web 2.0. You will create PHP projects that grab data from one place on the Web, mix it up with relevant information from another place on the Web and present it in a single application.

This book is made up of five real-world PHP projects. Each project begins with an overview of the technologies and protocols needed for the project, and then dives straight into the tools used and details of creating the project:

  •     Look up products on Amazon.Com from their code in the Internet UPC database
  •     A fully customized search engine with MSN Search and Yahoo! 
  •     A personal video jukebox with YouTube and Last.FM
  •     Deliver real-time traffic incident data via SMS and the California Highway Patrol!
  •     Display pictures sourced from Flickr in Google maps

All the mashup applications used in the book are built upon free tools and are thoroughly explained. You will find all the source code used to build the mashups used in this book in the code download section for this book.

Create PHP projects that grab and mix data from the likes of Google Maps, Flickr, Amazon, YouTube, MSN Search, Yahoo!, Last.fm, the Internet UPC Database, not to mention the California Highway Patrol Traffic service!

Book Reviews

Chris Cornutt: "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."

Julio Garcia: "For web developers, in particular front-end developers with below expert level PHP skills (like myself), this book can be a great resource to learning about API’s and web services."

Martin Malý: "The text is short enough to hold reader’s attention, but full of valuable information... So, it has inspired at least me."

Approach

This book is a practical tutorial with five detailed and carefully explained case studies to build new and effective mashup applications.

Who this book is for

If you feel confident with your PHP programming, familiar with the basics of HTML and CSS, unafraid of XML, and interested in mashing things up, this is the book for you!

There are a lot of formats and protocols, web services and web APIs encountered in this book — you do not need to know anything about them or about AJAX; you will find all you need in the book.

PHP Web 2.0 Mashup Projects: Practical PHP Mashups with Google Maps, Flickr, Amazon, YouTube, MSN Search, Yahoo!

 

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software