Created
May 13, 2013 05:47
-
-
Save holin/5566381 to your computer and use it in GitHub Desktop.
curb(https://github.com/taf2/curb) 绑定ip和使用代理
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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