PhpRiot
Download This Article
Download this article in PDF format with all listings and files.

Price: $5.00 AUD
(Approx. $4.10 USD)

More information
Browse Articles
Ajax (4), APC (1), CAPTCHA (1), CSS (3), Debugging (1), File Upload (1), Google (3), Google Maps (2), JavaScript (12), JSON (2), MVC (1), MySQL (7), onbeforeunload (1), OOP (1), PHP (28), PhpDoc (1), PostgreSQL (6), Prototype (11), Reflection (1), RFC 1867 (1), Robots (1), Scriptaculous (1), SEO (1), Sessions (1), SimpleXML (1), Smarty (5), SOAP (1), SPL (1), Templates (2), W3C (1), XHTML (1), Zend Framework (1), Zend_Search_Lucene (1)

PhpRiot Newsletter
Your Email Address:

Searching Google With The Google API

Things You Should Know

There are a few things you should be aware of before using the Google API, mainly to do with terms and restrictions on the service:

  • Google’s terms of service say it is for “personal, non-commercial use only”
  • There is a limit of 1,000 queries per day using your license key
  • You can only fetch 10 results at a time, and you can’t get results past the 1,000th result.
  • A single query can have 10 terms at most

There’s not much you can do about the first of these restrictions, although this is not specifically clear. For example, this web site is non-commerical – does that mean it could be used on here?

The second limitation (1,000 queries per day) can be overcome by using caching. So whenever you perform a query, save the results to a file, then when somebody performs the same request you can just fetch the results from your hard disk instead of querying Google again. Implementation of this is not covered in this article, but if you’re interested, PEAR’s Cache_Lite might be a good starting point.

In This Article


Tagged in , ,