Hello, I'm having a bit of frustration attempting to authenticate via mechanize... I'm trying to log in to ancestry.com with:
#!/usr/bin/perl -wd use strict; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); my $response = $mech->get( "https://secure.ancestry.com/login" ); $mech->submit_form( form_number => 1, fields => { Username => 'MyUserName', Password => 'MyPassword', ReturnUrl => '' }, ); print $response->as_string( );

mech-dump https://secure.ancestry.com/login shows the form to look like this:

POST https://secure.ancestry.com/Login

Username= (text)

Password= (password)

ReturnUrl= (hidden readonly)

I think my confusion may be that I don't know what to do with the 'ReturnUrl' field so (I believe) I'm passing it back a null entry...

Anyway, each time I run it the server gives back a standard 'unknown user/pass' page...

I've double/triple checked my user/pass is correct.

Anyone have any ideas on this one?

Thank you!

JclH

Update

Thank you guys for the replies. Not sure which one, but one of the suggestions seems to have worked. Thanks!

In reply to WWW::Mechanize authentication problem by jclh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.