Ruby 使用 HTTP 代理的例子

2015-10-02 0 150
Ruby 使用 HTTP 代理的例子
require 'net/http'

web_proxy = Net::HTTP::Proxy('your.proxy.hostname.or.ip', 8080)

url = URI.parse('http://www.rubyinside.com/test.txt')

web_proxy.start(url.host, url.port) do |http|
  req = Net::HTTP::Get.new(url.path)
  puts http.request(req).body
end

遇见资源网 ruby Ruby 使用 HTTP 代理的例子 http://www.ox520.com/16498.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务