Does this having anything to do with this recent key business, or
depreciated SOAP? Why am I getting a 502?
here is the code and output
require 'google'
require 'cgi'
key=File.read(File.join(ENV['HOME'], ".google_key")).chomp
google=Google::Search.new(key)
result=google.search('pragmatic')
printf "Estimated number of results is %d.\n",
result.estimatedTotalResultsCount
printf "Your query took %6f seconds. \n", result.searchTime
first=result.resultElements[0]
puts first.title
puts first.url
puts CGI.unescape(first.snippet)
and here is the output
/opt/local/lib/ruby/vendor_ruby/1.8/http-access2.rb:217:in
`get_content': Unexpected response: #<HTTP::Message::Headers:0x1659ef0
@response_status_code=502, @body_charset=nil, @request_uri=nil,
@header_item=[["Date", "Wed, 20 Dec 2006 07:07:59 GMT"],
["Content-Type", "text/html"], ["Server", "GFE/1.3"], ["Cneonction",
"Close"], ["Content-Length", "1403"]], @body_type=nil,
@request_method=nil, @chunked=false, @body_date=nil,
@request_via_proxy=nil, @http_version="1.1", @reason_phrase="Bad
Gateway", @body_size=0, @request_query=nil, @is_request=false>
(RuntimeError)
Manfred