I've captured the login HTTP headers using firefox plugin LiveHTTPheaders.
I've found the following url and variables.
POST /login
email=myemail%40gmail.com&password=something&remember=1&loginSubmit=Login
And here's the code I am running:
require 'rubygems'
require 'mechanize'
browser = Mechanize.new
browser.post('http://www.mysite.com/login',
[
["email","myemail%40gmail.com"],
["password","something"],
["remember","1"],
["loginSubmit","Login"],
["url"=>""]
]
) do |page|
puts page.body
end
However, this gives me nothing ! is something wrong with my post parameters ?
post() doesn't take a block. Try this:
page = browser.post('http://www.mysite.com/login', {
"email" => "myemail%40gmail.com",
"password" => "something",
"remember" => "1",
"loginSubmit" => "Login",
"url" => ""
})
edit: changed for accuracy