需要帮助 nokogiri 宝石
当我通过HTTPS打开XML文件
No such file or directory error - https://mysecret.link?username=name&password=pass
提高
source = open('https://mysecret.link?username=name&password=pass')
data = Nokogiri::XML(source)
你require 'open-uri'
了吗?否则open
不适用于远程文件。
>> open("http://google.com")
Errno::ENOENT: No such file or directory - http://google.com
...
>> require 'open-uri' #=> true
>> open("http://google.com") #=> #<File:/tmp/open-uri20111215-27666-1jeeiqo>
require 'net/https'
url = URI.parse("https://address")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = (url.scheme == 'https')
request = Net::HTTP::Get.new(url.path)
response = http.start {|http| http.request(request) }