Method: Net::HTTP.post

Defined in:
lib/net/http.rb

.post(url, data, header = nil) ⇒ Object

Posts data to the specified URI object.

Example:

require 'net/http'
require 'uri'

Net::HTTP.post URI('http://www.example.com/api/search'),
               { "q" => "ruby", "max" => "50" }.to_json,
               "Content-Type" => "application/json"


499
500
501
502
503
504
# File 'lib/net/http.rb', line 499

def HTTP.post(url, data, header = nil)
  start(url.hostname, url.port,
        :use_ssl => url.scheme == 'https' ) {|http|
    http.post(url, data, header)
  }
end