新手问题 如何使用 Net::HTTP::POST 访问一个 https 协议

rails_taotao · July 09, 2019 · Last by rails_taotao replied at July 10, 2019 · 1614 hits
def post_request(url, params)
    uri = URI.parse('https://....')
    https = Net::HTTP.new(uri.host, uri.port)
    https.use_ssl = true
    req = Net::HTTP::Post.new(uri.path)
    req.set_form_data(params)
    res = https.request(req)
    puts res.body
            end

提示的错误信息是

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired)
You need to Sign in before reply, if you don't have an account, please Sign up first.