Skip to content

Instantly share code, notes, and snippets.

@bds
Created March 26, 2011 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bds/887948 to your computer and use it in GitHub Desktop.
Save bds/887948 to your computer and use it in GitHub Desktop.
Typhoeus using a proxy
require 'rubygems'
require 'typhoeus'
require 'ap'
begin
request = Typhoeus::Easy.new
request.url = "http://www.google.com"
request.max_redirects = 2
request.verbose = 1
request.method = :get
request.timeout = 100
request.proxy = {:server => "http://10.0.0.1:80",
:type => Typhoeus::Easy::PROXY_TYPES[:CURLPROXY_HTTP] }
request.proxy_auth = {:username => "foo", :password => "bar"}
request.perform
ap request.response_body
rescue Interrupt
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment