Ruby on rails 无法使用curl、httparty或net::http在https协议中获取任何内容
我无法使用https获取任何内容 我找不到像这样的东西:Ruby on rails 无法使用curl、httparty或net::http在https协议中获取任何内容,ruby-on-rails,ruby,curl,https,httparty,Ruby On Rails,Ruby,Curl,Https,Httparty,我无法使用https获取任何内容 我找不到像这样的东西: curl -k https://graph.facebook.com 或 我得到: error: EOFError: end of file reached HttpParty和https也没有什么好运气,因为您使用的是“https”协议,在使用net/http库时,必须明确说明: require 'net/http' uri = URI('https://graph.facebook.com/davidarturo') http
curl -k https://graph.facebook.com
或
我得到:
error: EOFError: end of file reached
HttpParty和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
使用“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