Emulating Browser Session (like Curl)?


#1

I have a process that I want to emulate:

  • login (and remember cookies set)
  • access pages that require being logged in

With Curl, it’s pretty easy:

curl -c cookies -d “username=joe&password=12345” secret.com/login
curl -b cookies secret.com/dostuff

I searched for Curl Ruby libraries and found:

http://www.d1.dion.ne.jp/~matuyuki/ruby.html (0.0.2 alpha)
http://rox-ruby.sourceforge.net/cms.php/curl (pre-alpha - May 2003)

Any other options, or libraries? Is open-uri capable of something
similar?

Thanks,
Joe


#2

On Jun 12, 2006, at 9:47 PM, Joe R. wrote:

I searched for Curl Ruby libraries and found:

Posted via http://www.ruby-forum.com/.

Methinks you require WWW::Mechanize
http://www.ntecs.de/blog/Blog/WWW-Mechanize.rdoc


#3

On Tue, Jun 13, 2006 at 10:47:06AM +0900, Joe R. wrote:

I searched for Curl Ruby libraries and found:

http://www.d1.dion.ne.jp/~matuyuki/ruby.html (0.0.2 alpha)
http://rox-ruby.sourceforge.net/cms.php/curl (pre-alpha - May 2003)

Any other options, or libraries? Is open-uri capable of something
similar?

Check out WWW::Mechanize:

http://mechanize.rubyforge.org/

Or just install it: ‘gem install mechanize’

–Aaron