method

get_response

v2_2_9 - Show latest stable - Class: Net::HTTP
get_response(uri_or_host, path = nil, port = nil, &block)
public

Sends a GET request to the target and returns the HTTP response as a Net::HTTPResponse object. The target can either be specified as (uri), or as (host, path, port = 80); so:

res = Net::HTTP.get_response(URI('http://www.example.com/index.html'))
print res.body

or:

res = Net::HTTP.get_response('www.example.com', '/index.html')
print res.body