Reputation: 8602
I have a form I would like to submit through the Mechanize module.
I have selected the form_number
and did a dump_forms()
and it returned
POST http://URL (multipart/form-data)
field1= (text)
field2= (text)
field3= (email)
actionbutton=Enter (submit)
Here is my resulting code:
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new();
my $url = "http://URL";
$mech->get($url);
$mech->form_number('1');
$mech->dump_forms();
my $result = $mech->submit_form(
form_number => 1,
fields =>
{
field1 => 'Test1',
field2 => 'Test2',
email => '[email protected]',
actionbutton => 'Enter'
},
);
print $result->content();
But here is what that outputs.
What am I doing incorrectly?
Upvotes: 0
Views: 58
Reputation: 98398
You probably want $result->decoded_content()
, not $result->content()
.
See https://metacpan.org/pod/HTTP::Response#r-content-bytes
Upvotes: 3