Posting Forms


#1

Posting forms looks like it should be easy with Ruby 1.8.3 and
net/http.

Can anyone provide an example of submitting a search to e.g.
www.google.com,
and printing out the results?

This code doesn’t seem to work.

require ‘net/http’
require ‘uri’

#site=‘http://www.google.com’ doesn’t work either

#site=‘http://www.google.com/search
btnG=‘random’

res = Net::HTTP.post_form(URI.parse(site),
{‘btnG’=>btnG})
puts res.body

-Chris