barsalou
2011-Jul-02 21:11 UTC
[Mechanize-users] Doing a post using Mechanize 2.0 - a solution
I''m working with a web page where it is required that you log in, then use a POST to submit the information via a form. Since this isn''t part of my everyday life, it was a struggle to figure out the pieces that were needed to make this happen. We needed to: - login - get the cookie info - make a new request that included the returned cookie info - post the request with necessary form data The example also shows how to add custom headers to the posted request. Firefox''s TamperData Add-on was needed to see what the server was expecting in order to put this together. Here is my solution: https://gist.github.com/1061645 Suggestions for slimming this down or other changes are welcome. Mike B. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.