get_response

get_response(uri_or_host, path = nil, port = nil, &block)
Class Public methods

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
doc_ruby_on_rails
2015-04-20 20:32:53
Comments
Leave a Comment

Please login to continue.