get_response(uri_or_host, path = nil, port = nil, &block) public

Send a GET request to the target and return the 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.parse('http://www.example.com/index.html'))
print res.body


res = Net::HTTP.get_response('www.example.com', '/index.html')
print res.body
Show source
Register or log in to add new notes.