Forum: Ruby How to login in a page whit a ruby program

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F26a980dd7308b7b67ae73997e9e9399?d=identicon&s=25 Emmanuel Cruz (exg10)
on 2008-12-15 14:29
I need to make a program for login and logout in a  web site
(www.zenzuu.com)
0dd9e123e165b4b580fa8fc547306aca?d=identicon&s=25 Jason Trebilcock (Guest)
on 2008-12-15 15:15
(Received via mailing list)
On Mon, Dec 15, 2008 at 7:22 AM, Emmanuel Cruz
<ecruzg_10@hotmail.com>wrote:

> I need to make a program for login and logout in a  web site
> (www.zenzuu.com)
> --
> Posted via http://www.ruby-forum.com/.
>
>
One option would be to use Watir: http://wtr.rubyforge.org/

That's a good starting point.
134ea397777886d6f0aa992672a50eaa?d=identicon&s=25 Mark Thomas (Guest)
on 2008-12-15 15:46
(Received via mailing list)
That's what Mechanize is for.

http://mechanize.rubyforge.org/mechanize/
Bd1eb98afbd45a00bceea257599a495e?d=identicon&s=25 jannschu@googlemail.com (Guest)
on 2008-12-15 18:05
(Received via mailing list)
Hi,

or you can use pure net/http from the standard lib. Then you only need
managing the cookies:

1. load the login page and (if needed) extract the form data
2. create a login post reqeuest and send it, store the cookies (if
some) and send them back next time
3. now you can open the next pages as if you were logged in

That's all. Logout is simply open the logout page or send the logut
post request. Mechanize just helps you storing your cookies.
You will maybe also need something like nokogiri or hpricot for html
parsing.


jannschu
This topic is locked and can not be replied to.