Created
September 24, 2012 13:47
-
-
Save fenomenog4/3776036 to your computer and use it in GitHub Desktop.
Cliente de formulario de login simple con mechanize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
a = Mechanize.new | |
a.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
a.get('http://sau/module.php/core/authenticate.php?as=sau') do |login_page| | |
# Submit the login form | |
my_page = login_page.form_with(:name => 'f') do |f| | |
f.username = '******@grammata.es' | |
f.password = '******' | |
end.submit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment