I am having trouble to get anything using https.
I can't fetch anything like:
curl -k https://graph.facebook.com
or
uri = URI('https://graph.facebook.com/davidarturo')
Net::HTTP.get(uri)
I get:
error: EOFError: end of file reached
Also there is no luck with httparty and https
As you use 'https' protocol, you must explicitly tell about it in case of using net/http
library:
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
来源:https://stackoverflow.com/questions/8200048/cannot-get-anything-in-https-protocol-with-curl-httparty-or-nethttp