Skip to content

Instantly share code, notes, and snippets.

@nrk
Created September 23, 2008 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrk/12318 to your computer and use it in GitHub Desktop.
Save nrk/12318 to your computer and use it in GitHub Desktop.
Post form data using https
require 'net/http'
require 'net/https'
post_url = URI.parse('https://my.host.name/path/to/post')
request = Net::HTTP::Post.new(post_url.path)
request.set_form_data({
'name' => 'nrk',
'test' => '1',
# ...
})
http = Net::HTTP.new(post_url.host, post_url.port)
http.use_ssl = true
response, body = http.start { |http| http.request(request) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment