Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def post(url, params)
- url = URI.parse(url.to_s) unless url.is_a?(URI)
- req = Net::HTTP::Post.new(url.path)
- req.form_data = params
- http = Net::HTTP.new(url.host, url.port)
- main = self
- http.instance_eval do
- @debug_output = $stderr if main.params['debug'].given?
- http.use_ssl = true
- @ssl_context = OpenSSL::SSL::SSLContext.new
- @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
- end
- http.start{|http| http.request(req)}
- end
Add Comment
Please, Sign In to add comment