Forum: Ruby GET HTTPS request with Ruby 2.3.0

1057478e3cb6dc53aa4d46220dd9d189?d=identicon&s=25 Rub Rubinsky (rubinsky)
on 2017-02-09 21:58

I'm stuck with an error when I try to do a get request.
`connect_nonblock': SSL_connect returned=1 errno=0 state=error:
certificate verify failed (OpenSSL::SSL::SSLError)

This was my code:

uri = URI(link)
Net::HTTP.start(, uri.port,
  :use_ssl => uri.scheme == 'https') do |http|
  request = uri

  response = http.request request # Net::HTTPResponse object
  puts response.body

Have anyone else gotten the same connection error before?

Found my answer.
I needed to add:

require 'openssl'
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.