you are here: codestackercodes [RSS] → tag get [RSS]

ruby get request

require 'net/http'
require 'uri'

url = URI.parse('http://www.rubyonrails.org')
res = Net::HTTP.start(url.host, url.port) do |http|
  http.get('/index.html')
end
puts res.body
Displaying 1 Code