Skip to content

Instantly share code, notes, and snippets.

@holin
Created May 13, 2013 05:47
Show Gist options
  • Select an option

  • Save holin/5566381 to your computer and use it in GitHub Desktop.

Select an option

Save holin/5566381 to your computer and use it in GitHub Desktop.
curb(https://github.com/taf2/curb) 绑定ip和使用代理
require "minitest/autorun"
class TestInterface < Minitest::Test
def test_interface
test = "http://www.baidu.com"
ip = "172.16.3.14"
require 'curb'
c = Curl::Easy.new do |curl|
curl.url = test
curl.proxy_port = 8080
curl.proxy_url = "175.107.248.50" #使用代理
curl.interface = ip #绑定ip
curl.timeout = 10
end
c.perform
puts c.body_str
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment