Although the primary method of making POST requests with your web browser or Mechanize is by submitting forms, you can also manually make POST requests with the Mechanize#post method.
To make a POST request with no parameters, simply pass the URL to the Mechanize#post method.
agent.post('http://example.com/update')
However, that's not very interesting. To make a POST request with the request body populated with key/value pairs, pass a hash as the second argument.
agent.post('http://example.com/update'
{ :message => "Hello, world" })
Interestingly, Mechanize also supports multipart/form-data POST request (also known as file uploads). If any of the keys in the hash are IO objects, they will be handled correctly.
File.open('message.txt') do|message|
agent.post('http://example.com/upload/',
{ :message => message })
end
The final parameter to Mechanize#post is a hash of custom parameters, as with Mechanize#get.

