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.