GoogleDuel: Web Services And PHP

"Web Services" are emerging standards enabling companies to work together more easily across the Internet. Web Services currently allow software developers to create their own storefronts for e-commerce sites like Amazon.com, to incorporate the latest stock quotes and weather information into online applications, and to integrate data from diverse sources such as mapping databases or search engines. The growth potential for Web Services is high: according to IDC Research, "Web Services will become the dominant distributed computing architecture in the next 10 years and will eventually define the fabric of computing." As well as discussing the business implications of Web Services, this session will show how PHP is ideally suited for the deployment of Web Services, working with technologies such as XML, SOAP, WSDL, and HTTP. The session will demonstrate several examples of PHP-based Web Services applications, created by the presenter.

 

About the Author:
Geoff Peters recently graduated with a joint major in Computing Science and Business from SFU. He has worked as a software developer for Nokia Mobile Phones and Canada Safeway IT. He is the creator of Googleduel.com, a web site which uses the Google search engine to analyze the popularity of people, products, and names on the Internet. He is also the webmaster for FoodVancouver.com, a popular Vancouver dining guide. Geoff is also an avid musician who plays piano in a Vancouver jazz band and a folk/country dance band.

View other presentations by Geoff Peters.

 

background image
1
Harnessing Web Services
With PHP
Geoff Peters
PHP Vancouver Conference
Jan. 23, 2004
background image
2
What are Web Services
Emerging standards
Allow service applications to be
accessible across the web to client
(non-human) applications
Example: Incorporating a web-based
mapping service into your pizza delivery
application.
background image
3
Pizza Application Example
Mapping
Database
Internet
Pizza
Delivery
Application
Web Services
Thanks, Web
Services!
background image
4
Some Uses of Web Services
Business to Business (B2B)
communication
Online storefronts
Syndication of News Feeds
background image
5
Examples of Web Services
Amazon.com (Storefronts)
Google.com (Google API)
Microsoft (MSDN, Terraservice, Mappoint,
.NET Alerts)
Bioinformatics (EMBL Nucleotide Sequence
Database, BQS)
AllConsuming.Net
Weblogs.com, Technorati.com, and
Alexa.com
background image
6
Problem of Information
Fragmentation
Information is scattered in thousands of
different databases/resources
Currently, each resource (or group)
must be manually accessed
Growth of available information sources
Each resource has its own proprietary
way to access it!
background image
7
Need for Common Standards
Web Services standards
will allow information from diverse sources
to be collected and combined in new ways
Future of the Internet
More integrated, useful, smarter,
customizable.
background image
8
Case Study: Google.com
Google provides Web Services access to
its search engine ("Google API").
Allows programmers to retrieve search
results using code.
"Developer's Program" encourages
creativity
Limits each user to 1000 searches/day
background image
9
GoogleDuel.com
An online popularity ranking system.
Uses Google's API to obtain estimated
count of search results for each term.
Example:
1.
coke (
1,010,000
)
2.
pepsi (
633,000
)
How about PHP vs ASP?
background image
10
PHP Wins!
GoogleDuel results:
1. PHP (86,600,000)
2. ASP (78,200,000)
Good news for the PHP community!
background image
11
Uses of GoogleDuel.com
Business can analyze their web
presence
Compare popularity of company name,
product lines, brands, CEO, slogans with
competitors
Use over time can show trends such as
growing popularity of a product
background image
12
GoogleDuel for Writers
GoogleDuel as a tool for writers
Helps decide what phrase or word to use:
Compare similar words or phrases
Use with a thesaurus to check popularity of
a phrase
"Writers" version of GoogleDuel allows
comparison of up to 10 phrases at once.
background image
13
GoogleDuel Ultra
More sophisticated ranking system.
Ranks for a list of adjectives.
Examples:
Britney Spears is more popular, but is she
more creative or talented?
Which grocery chain has the best service?
Try it at
http://www.googleduel.com
background image
14
Other Uses of Google API
Gender Guesser
Searches for common patterns involving a
first name.
Calculates likelihood person is male or female.
Calculates popularity of name.
Works for ethnic names (ex. "Naveen")
Saves data and produces reports, ex:
"Most Popular Names"
"Most Feminine Names"
background image
15
Demos (if time)
GoogleDuel
http://www.googleduel.com
Gender Guesser
http://cgi.sfu.ca/~gpeters/cgi-
bin/pear/gender.php
background image
16
Technical Side
Some current Web Services standards:
SOAP
XML based protocol, works over HTTP.
Allows variables to be passed to/from a
remote procedure call.
Parameter format defined in a WSDL document
Adopted by Microsoft (.NET), Google,
Amazon.
background image
17
A competing standard to SOAP
"REST" ­ "Representational State
Transfer"
HTTP based
Uses HTTP for security/authentication
Parameters encoded in URL, not in a SOAP
envelope.
Returns an XML document.
Some advocate it as "second generation
web services"
Some sites provide REST interfaces as well as SOAP.
background image
18
PHP Support for Web Services
SOAP package in Pear library
Developed by Shane Caraveo and Arnaud
Limbourg
Provides both Client and Server support
Makes Web Services easy to write and
access for PHP developers.
NuSOAP
An alternate library, quite popular.
background image
19
Example ­ Accessing Google
include("SOAP/Client.php");
$soapclient = new SOAP_Client('http://api.google.com/search/beta2');
$soapoptions = array('namespace' => 'urn:GoogleSearch',
'trace' => 0);
$ret = $soapclient->call('doGoogleSearch', $params = array(
'key' => $key, 'q' => $query, 'start' => 0, 'maxResults' => 1, 'filter' =>
false, 'restrict' => '', 'safeSearch' => false, 'lr' => '', 'ie' => '', 'oe'
=> '',), $soapoptions);
if (PEAR::isError($ret))
{ // error handling goes here
}
else // We have proper search results
{
// Results from the Google search are stored in the object $ret.
// in this example, the only thing we need from the search results
// is the estimatedTotalResultsCount
$num = $ret->estimatedTotalResultsCount;
}
background image
20
Growth of Web Services
According to IDC Research, "Web
services will become the dominant
distributed computing architecture in
the next 10 years and will eventually
define the fabric of computing."
Reducing integration costs
Service-oriented computing as opposed
to presentation-oriented
background image
21
Web Services Business Models
Charge small amount per-use of service
Eventually, will Google do this?
Subscription-based services
Microsoft's Mappoint.
Use free Web Services to generate sales
and interest
Amazon's storefront approach
background image
22
Other Business Models
Better vertical integration
Automated information exchanges between
different levels in distribution channels
Business to Business services
Mobile Web Services
Web services on wireless devices / cell
phones
background image
23
Advantages of Web Services
Shorter Development Time
No need to "re-invent the wheel".
Libraries for web services becoming more
stable.
Standardized Integration
Standardized Access
Use universal HTTP protocol.
Can be accessed anywhere on Internet.
background image
24
Current Challenges
Service discovery
How to locate Web Services
Create a registry of web services, ex. UDDI
Security and reliability (authentication,
encryption)
Ex: Use existing protocols such as SSL with
credentials/Token Based authentication
Transactions
Multiple transactions ­ synchronous/asynchronous
Performance
background image
25
Comparing Web Services with
other Distributed Models
Other distributed models:
CORBA, DCOM, Java/RMI
For use within a homogeneous system, or cooperating
enterprise systems.
Not well suited for use over Internet.
Web Services will not replace these existing
standards
For use in exchange of information in a
decentralized, distributed environment.
i.e. over the Internet.
background image
26
Conclusion
Web services are important to the
future of the Internet (service-oriented
computing).
PHP libraries make web services easy
and accessible for PHP developers.
background image
27
Links
Web Services Business Article (USA Today)
http://www.usatoday.com/money/industries/technology/2003-
09-30-amazon_x.htm
SOAP
http://www.soapware.org
REST
http://www.xfront.com/REST-Web-Services.html
PHP Soap Server Tutorial
http://www.phppatterns.com/index.php/article/articleview/41/1/
2/
PHP Soap Client Tutorial
http://www.phppatterns.com/index.php/article/articleview/39/1/
2/
Web Services Tutorial (By Shane Caraveo)
http://talks.php.net/show/soap-phpcon-ny2003/
background image
28
Contacts
Geoff Peters (SFU)
www.sfu.ca/~gpeters
gpeters at sfu dot ca
Shane Caraveo (ActiveState) shane at
caraveo dot com
background image
29
Thank You
Questions?
 

This Page Copyright (c) 2006 Geoff Peters.

View other presentations by Geoff Peters.