Get response for HTTP requests, : Proxy « Network « Ruby






Get response for HTTP requests,




require 'net/http'

web_proxy = Net::HTTP::Proxy('your.proxy.hostname.or.ip', 8080)
url = URI.parse('http://www.rubyinside.com/test.txt')

response = web_proxy.get_response(url)
puts response.body

 








Related examples in the same category

1.web_proxy replaces the reference to Net::HTTP when using the start method.