Starting Dec 2006, Google has deprecated its SOAP API for search. Read more about it here and here.
Google's SOAP API was a very simple mechanism to add Google's searching power to any application. It was used as an example to teach the basics of web services in many books and online tutorials.
This move from Google comes as a surprise but they probably have their reasons. Anyway in this post I don't want to discuss company strategies; I'll take this opportunity to show how to use SOAP in Ruby...
require 'soap/wsdlDriver' WSDL_URL="http://evilapi.com/api/GoogleSearch.wsdl" # a workaround API (legal?) # WSDL_URL = "http://api.google.com/GoogleSearch.wsdl" # original API soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver query = 'Aman King India' key = '' # a licenced key from Google to use API; not needed for workaround API result = soap.doGoogleSearch(key, query, 0, 1, false, nil, false, nil, nil, nil) puts "Estimated number of results: #{result.estimatedTotalResultsCount}" puts "The query took #{result.searchTime} seconds" first_result = result.resultElements[0] puts "#{first_result.title} -- #{first_result.uRL}"