Method: Net::HTTP.get
- Defined in:
- lib/net/http.rb
.get(uri_or_host, path = nil, port = nil) ⇒ Object
Send a GET request to the target and return the response as a string. The target can either be specified as (uri), or as (host, path, port = 80); so:
print Net::HTTP.get(URI.parse('http://www.example.com/index.html'))
or:
print Net::HTTP.get('www.example.com', '/index.html')
355 356 357 |
# File 'lib/net/http.rb', line 355 def HTTP.get(uri_or_host, path = nil, port = nil) get_response(uri_or_host, path, port).body end |