Posting Forms

Discussion in 'Ruby' started by Chris Long, Dec 20, 2005.

  1. Chris Long

    Chris Long Guest

    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
     
    Chris Long, Dec 20, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alanb
    Replies:
    2
    Views:
    577
    alanb
    Apr 23, 2004
  2. =?Utf-8?B?SWdneSBFdmFucw==?=
    Replies:
    2
    Views:
    3,146
    =?Utf-8?B?SWdneSBFdmFucw==?=
    Apr 25, 2004
  3. Fernie
    Replies:
    6
    Views:
    569
    Fernie
    Dec 4, 2004
  4. AmitKu
    Replies:
    7
    Views:
    586
    John Timney \(MVP\)
    Jan 8, 2007
  5. Eric
    Replies:
    2
    Views:
    648
Loading...

Share This Page