Mega Code Archive

 
Categories / Ruby / Network
 

Web_proxy replaces the reference to Net

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