Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^2: form not being filled out by WWW::Mechanize

by Special_K (Beadle)
on Mar 13, 2013 at 03:39 UTC ( #1023099=note: print w/replies, xml ) Need Help??

in reply to Re: form not being filled out by WWW::Mechanize
in thread form not being filled out by WWW::Mechanize

Here is my updated code:

#!/usr/bin/perl -w use strict; use WWW::Mechanize; my $response = ""; my $m = WWW::Mechanize->new(); $m->agent_alias('Linux Mozilla'); #$m->get(''); $m->get(' +cid=40'); printf("%s\n", $m->title()); $m->dump_forms(); $response = $m->submit_form( form_number => 1, fields => { 'cid_40$txtUsername' => '<username>', 'cid_40$txtPassword' => '<password>', } ); die unless ($m->success); printf("response code is %s\n", $response->code); printf("response message is %s\n", $response->message); printf("response content is %s\n", $response->content); printf("response header time is %s\n", $response->header('date'));

The above should be correctly parsing the response from the command. The only problem is that the response doesn't seem to indicate what is going on:

response code is 200 response message is OK response content is (tons of binary data) response header time is Wed, 13 Mar 2013 03:36:18 GMT

I can't figure out from the above what is going on. Does anyone have any hints/tips? Note that I get the above response even if I enter a deliberately incorrect username and/or password.

Replies are listed 'Best First'.
Re^3: form not being filled out by WWW::Mechanize
by Anonymous Monk on Jul 27, 2013 at 08:49 UTC
    $m->res->dump; ## I AM DEBUGGING HERE $m->content; ## DECODED CONTENT HERE, if gzipped, its gunzipped , etc
      Is it because you are single quoting your username and password variables?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023099]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2018-01-20 08:09 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (226 votes). Check out past polls.