无法使用curl,httparty或net :: http获取https协议中的任何内容

我无法使用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也没有运气

当您使用“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