怎么抓取 https 页面的源码,请指教!
require 'net/https' url = URI.parse('https://ruby-china.org/topics/23714') http = Net::HTTP.new(url.host, url.port) http.use_ssl = true if url.scheme == 'https' request = Net::HTTP::Get.new(url.path) puts http.request(request).body
require 'open-uri' puts open('https://ruby-china.org/topics/23714').read
#2 楼 @Rei :plus1: