post_form(url, params) public

Posts HTML form data to the specified URI object. The form data must be provided as a Hash mapping from String to String. Example:

{ "cmd" => "search", "q" => "ruby", "max" => "50" }

This method also does Basic Authentication iff url.user exists. But userinfo for authentication is deprecated (RFC3986). So this feature will be removed.


require 'net/http'
require 'uri'

HTTP.post_form URI('http://www.example.com/search.cgi'),
               { "q" => "ruby", "max" => "50" }
Show source
Register or log in to add new notes.