我无法使用https获取任何内容。
我无法取得类似的内容:
curl -k https://graph.facebook.com
或
uri = URI('https://graph.facebook.com/davidarturo')
Net::HTTP.get(uri)
我明白了:
error: EOFError: end of file reached
此外,httparty和https
也没有运气答案 0 :(得分:1)
当您使用“https”协议时,必须在使用net/http
库时明确告知它:
require 'net/http'
uri = URI('https://graph.facebook.com/davidarturo')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
http.start do |h|
response = h.request Net::HTTP::Get.new(uri.request_uri)
puts response.body if Net::HTTPSuccess
end