Home / Articles / Creating a Google Image Widget Using the Google Search API

Creating a Google Image Widget Using the Google Search API

Article Description

The widgets provided by Google are a great way to get the functionality you’re looking for without writing any code, but sometimes there’s a need for a little more control and flexibility with layout, design, etc. Kris Hadlock explains the steps that are necessary to use the RESTful interface provided through the Google Ajax Search API in order to create a custom JavaScript Google Image widget.
Summary

Summary

It may seem like a lot of steps to get a custom widget working, but it’s not very difficult once you understand the process and you know the API. The process is really as simple as this: The request made to the gateway is first sent to gateway.php with the feed argument set to the Google Image Search API URL, the feed is then used to make a request via cURL to the actual API, and the response is written to the PHP page. The results written to the PHP page are in turn the response that Ajax receives and then it’s ready to be parsed by JavaScript.

6. Additional Resources | Next Section Previous Section