Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using Net::HTTP to the HTTPS url
require 'openssl'
require 'net/http'
https = Net::HTTP.new('www.google.co.jp', 443) # address, port
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
# https.verify_mode = OpenSSL::SSL::VERIFY_PEER
# https.ca_file = '/etc/ssl/cert.pem'
https.start do
response = https.get('/') # path
puts response.body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.