我设置了一个json方法来解析返回的数据,但我一直收到错误
OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):
def get_json(url)
encoded_url = URI.encode(url)
uri = URI(encoded_url)
result = Net::HTTP.get(uri) # => String
@json = Crack::XML.parse(result).deep_symbolize_keys
end
我还要求以下内容:
require 'open-uri'
require 'net/https'
require 'crack' # for xml and json
require 'crack/json' # for just json
require 'crack/xml' # for just xml