Introducing the API


Google launched its search API in 2002 to allow developers to directly access search results in an organized and manageable manner. Prior to that launch, many developers had been "scraping" Google search result pages (in violation of its Terms of Service (TOS)) to obtain information on rankings and perform more advanced search types. The API gives developers full access to the breadth of Google's search engine in an easier to manage format all without violating the TOS.

As with most commercial APIs, registration is required before use. If you already have an account for one of Google's services (not including GMail), you can use that account, otherwise the registration is pretty standard. You can find the registration page as well as documentation for the API at www.google.com/apis/index.html.

Registration will provide you with your own license key, which must be included with all queries against the API. Your license key will entitle you to 1,000 queries per day. However, if you anticipate using more than that, or even close to that number, it would be a good idea to contact Google and explain what you are planning to do with the API. They may be willing to increase your maximum query limit for you.

Once you have completed your registration, download the developer's kit from that same page; it contains documentation for the API, XML examples, a license, and so forth. The code examples are unfortunately (unless, for example, you want to write a book) not in PHP. However, all is not lost — the package includes a WSDL (Web Services Description Language) file called GoogleSearch.wsdl, which describes the functionality of the service in full. The soap-samples directory is also of particular interest because it contains sample transactions showing both the request and response in the appropriate format.

Beta Limitations

Google's entire API system is still considered (by Google, that is) to be in its Beta stages. As such, Google has clearly reserved the right to make major changes to the system in the future. These could range from simple protocol modifications to major licensing requirements or even a switch to a completely fee-based service. I have some belief in the theory that Google doesn't move a service out of the Beta stages until it can determine how to receive revenue from it. Knowing that there may be changes required to realize that revenue, Google retains the "Beta" tag until the possible revenue stream is fully understood. Regardless of the reasoning, keep your eyes open for news on how the service might change. That said, Google may simply decide to continue generously offering free access to its API in perpetuity. Just keep its restrictions and possible changes in mind when developing.




Professional Web APIs with PHP. eBay, Google, PayPal, Amazon, FedEx, Plus Web Feeds
Professional Web APIs with PHP. eBay, Google, PayPal, Amazon, FedEx, Plus Web Feeds
ISBN: 764589547
EAN: N/A
Year: 2006
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net