Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

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