Guest User

Untitled

a guest
Jul 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. def post(url, params)
  2. url = URI.parse(url.to_s) unless url.is_a?(URI)
  3. req = Net::HTTP::Post.new(url.path)
  4. req.form_data = params
  5. http = Net::HTTP.new(url.host, url.port)
  6. main = self
  7. http.instance_eval do
  8. @debug_output = $stderr if main.params['debug'].given?
  9. http.use_ssl = true
  10. @ssl_context = OpenSSL::SSL::SSLContext.new
  11. @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
  12. end
  13. http.start{|http| http.request(req)}
  14. end
Add Comment
Please, Sign In to add comment