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


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