Learning Ruby

How to fetch an https URL

require 'net/https'


host = "www.gmail.com"

https = Net::HTTP.new(host, 443)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE

url = "/"

response = https.get( url )

if response.message == "OK"
  puts response.body
end

 

 

July 21, 2010 at 2:42 pm