From: Eric Hodel Date: 2008-04-11T07:08:23+09:00 Subject: Re: User Agent String On Apr 10, 2008, at 07:56 AM, Ben Aroia wrote: > I've tried the above with the following: > user_agent = 'Ruby Net::HTTP' > print "Getting h\n" > h = Net::HTTP.new('http://www.google.com', 80) > print "getting response\n" > resp, data = h.get('/', {"User-Agent"=>user_agent}) > print data.body > print resp > print "should've printed\n" > > and all it gives me is: > SocketError: getaddrinfo: No address associated with nodename Net::HTTP#initialize takes a host and a port, not URI and port: $ ruby require 'net/http' h = Net::HTTP.new 'google.com', 'http' resp, data = h.get '/', "User-Agent" => "Ruby/#{RUBY_VERSION}" p resp, data # "[...][...]" $