in reply to WWW::Mechanize HTTPS

Oh ok I missed the obvious.

You're doing everything right except for one thing - and let this be a lesson - what exactly are you clicking on?

Have you had a look at the source code of the webpage..? Evidently you have or you wouldn't have filled in the form name and fields correctly..

Need help? OK the answer is that you are not clicking on anything, for one, because you're blindly calling $mechanize->click(). Secondly, the website in question uses javascript to submit the form. THAT is the part you shouldn't have missed.

So to fix, consider merely calling $mechanize->submit() instead of ->click(). Then print out the result of $mechanize->success() and $mechanize->uri() to confirm this worked as expected. This particular form merely calls itself so the uri may not give any clues as to the success, but the boolean $mechanize->success() will tell you if you've succeeded.

Replies are listed 'Best First'.
Re^2: WWW::Mechanize HTTPS
by BigRare (Pilgrim) on May 26, 2005 at 13:38 UTC
    I have found that sometimes using $mech->click() works in situations where $mech->submit() does not.

    For example:

    If I have a page that redirects to another page, based on a click input rather than a submit to the same URL.

    This becomes especially true in the world of dotNet where many submit buttons fire a JavaScript event to verify the form before allowing the page to be submitted.

    Usually, however, these same buttons have names and IDs, because that would be good website design. (Example: $mech->click('btnSubmit');) Though sometimes, just occasionally, buttons have neither a name nor and ID. This is where $mech->click() comes in handy.

    From the Documentation:

    If there is only one button on the form, $mech->click() with no arguments simply clicks that one button.