Brian Candler
4/7/2007 3:25:00 PM
On Sun, Apr 08, 2007 at 12:08:29AM +0900, Hey You wrote:
> I'm trying to make a little program that goes to a page and posts your
> username and password using a ruby socket but I don't know how to post
> data with a socket. I only know how to get data. I googled and haven't
> found anything so if anyone has a solution then it would be greatly
> appreciated.
Google for "ruby Net::HTTP". Or just type "ri Net::HTTP" at the command
line. After example #4 you'll see an example that makes a HTTP post.
Of course, if you really want to do this using a plain TCP socket, then it's
entirely up to you to send a correctly-formatted HTTP POST request and to
parse the response. You will need to read RFC 2616 if you want to do that.
If what you really want is to automate interaction with a website, look at
the Mechanize library.
HTH,
Brian.