我正在尝试做这样的事情,以便随机提出不同的IP请求。
random_ip = ["127.0.0.1", "127.0.0.2"].sample
conn = Faraday.new(:url => url) do |faraday|
faraday.request :url_encoded # form-encode POST params
faraday.response :logger # log requests to STDOUT
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
faraday.host random_ip
end
result = conn.get url
如果它在Linux专用服务器上存在任何差异,那么它就已经存在了。