Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Using www::Mechanize

by ItsyBitsy (Novice)
on May 17, 2012 at 03:37 UTC ( #970968=perlquestion: print w/replies, xml ) Need Help??
ItsyBitsy has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys,

I am using WWW::Mechanize to automate a script on the amazon page. However i am not even able to sign into the page using WWW::Mechanize. The url link. is where the form is. How would i use mechanize to log into this page.

My code:
use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get(""); $mech->submit_form( form_name => 'yaSignIn', fields => { 'email' => $email, 'password' => $password, }, ); print $mech->content();
The output of mech dump is as follows.
POST [yaSignIn] useRedirectOnSuccess=1 (hidden readonly) path=/gp/css/homepage.html (hidden readonly) action=sign-in (hidden readonly) protocol=https (hidden readonly) email= (text) password= (password) <NONAME>=Sign In (submit)
The html for sumbitting a form
<input width="201" type="image" height="22" border="0" align="absmiddl +e" id="submit" value="Continue" alt="sign in using our secure server" + src=" +mmon/buttons/sign-in-secure._V192194766_.gif">
When i save the output to file it says please enable cookies to continue.

Replies are listed 'Best First'.
Re: Using www::Mechanize
by stevieb (Abbot) on May 17, 2012 at 04:01 UTC

    The care you put into your post is going to be equivalent to the love contained within the responses you get.

    The time you took to create this post and not do any editing at all is embarrassing at best. You want help, but yet you don't care at all what you're presenting.

    At *minimum*, where's your code that you've tried?

      Sorry about that. Have edited the question now.
Re: Using www::Mechanize
by stevieb (Abbot) on May 17, 2012 at 04:33 UTC

    I'd like to rephrase my last reply without taking anything away from it...

    This is a place where many significant Perl coders hang out. I assume many of them review and post on this site while at work (regardless of what their day job is), and also while at home. I'm but a humble intermediary coder (depending on the context), but I sometimes let my emotions wreak havoc.

    It bothers me when I see poorly presented questions, as I'm learning how much it frustrates other monks who have better things to do. I used to get upset with terse responses. Now I'm starting to understand.

    To the OP: You might not have read How do I post a question effectively?, but it isn't fair to assume that this is just some one-off PHP forum you're in either.


      Kudos to ItsyBitsy for cleaning up the post.

      I'm sorry for my rant.

      Update: unfortunately, most won't see what my rant was about as the original was edited. Either way, it is what it is, and OP stepped up to the plate and did what was right.

        Finally got it. I had to add an agent alias. It was answered on stack overflow- link here.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://970968]
Approved by stevieb
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2018-02-25 08:15 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (312 votes). Check out past polls.