Wiley Professional Web APIs with PHP: eBay, Google, Paypal, Amazon, FedEx plus Web Feeds 978-0-7645-8954-6 用户手册

产品代码
978-0-7645-8954-6
下载
页码 4
Defining Web Ser vices
Web services are a collection of protocols that are used to exchange data between disparate applications
or systems. The essence of web services is the open standards on which they are built, by leveraging
public and common protocols like HTTP, along with the XML document model. Web services are easy 
to implement with existing technologies. Not only are you (as a PHP developer) already familiar with
many aspects of web services and the tools required, but you already have the facilities required to
deploy them.
Why They Are Used
Simply put, web services allow information to easily pass from those who have it to those who desire it.
Both feeds and APIs allow the requestor to obtain information from the service, regardless of the informa-
tion type. Web services allow customers to access the information they desire, without the extraneous
information generally presented on web pages. For example, running a search for a book on Amazon.com
will yield several relevant results, generally (under the current layout) in the center column of the page.
The right and left columns will contain other information, not directly related to your search (recom-
mended titles, recently viewed items, and so on). Performing the same search via the API will yield the
same results, but without that extraneous information.
This points to a key factor in web services — they are used to obtain specific information, or complete
specific tasks. Unlike people, the automated processes that utilize web services don’t make impulse deci-
sions (like choosing a recommended title from Amazon), so there is no point in presenting them with
those types of options.
How They Are Used
Web services generally present information already available via another method (that is, a website). The
advantage in the services is the consistent presentation of the information (in stark contrast to methods
like screen scraping) in an easy-to-parse format. Here are some examples:
Federal Express — Allows customers to do rate lookups and schedule shipments after logging
into its online system. These same tasks can be accomplished via its API; as such, customers
with larger shipping needs can integrate the API with their own systems to quickly automate
shipping, and allow customers to determine how much it will cost to ship a particular product.
Amazon — Allows customers to search for products via its website, and similar tasks can be
accomplished via its API (often with more granularity than the traditional web interface pro-
vides). Using the API allows small booksellers to transparently integrate with Amazon to offer
additional books and apply their own pricing.
My Personal Blog — Allows people to read my thoughts on various professional matters. The
feeds provided by my blog allow those people to read the posts on their own terms, within their
own client, without ads or cute pictures of my cat.
It’s important to recognize both types of interaction presented here. In some cases the web service is
accessed directly by the end user (as is often the case with blogs and feeds). In other cases the service is
consumed by an intermediate service, then presented (through various means) to its users.
4
Chapter 1
05_589547 ch01.qxp  6/22/06  6:17 PM  Page 4