Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: HTTP::Headers error when submitting form via WWW::Mechanize

by neeraj (Scribe)
on Jul 02, 2004 at 05:35 UTC ( #371312=note: print w/replies, xml ) Need Help??

in reply to HTTP::Headers error when submitting form via WWW::Mechanize

Perhaps the page you are retrieving is compressed. Try out this code , i haven't checked it as i don't have internet access, but i hope it works.
use strict; use warnings; use Compress::Zlib; use WWW::Mechanize; use WWW::Mechanize::FormFiller; # Initialize a new oblect my $mech = WWW::Mechanize->new(); # Fetch the given URL my $url = ""; $mech->get($url); # Throw error if page not found $mech->success or die "Can't fetch the Requested page"; # Uncompress the page my $dest = Compress::Zlib::memGunzip($mech->content); # Initialize a new object to retrieve the form my $f = WWW::Mechanize::FormFiller->new(); my $form = HTML::Form->parse($dest,$mech->base); # Fill the form with login & password and submit $f->fillout(user=>'xxx',password=>'xxx'); $f->fill_form($form); my $request = $form->click(); # Fetch the next page $mech->request($request); # Uncompress the page $dest = Compress::Zlib::memGunzip($mech->content); # Retrieve the form & check for string $form = HTML::Form->parse($dest,$mech->base); print "$form\n"; exit 0;
I hope this works. Neeraj.

Replies are listed 'Best First'.
Re^2: HTTP::Headers error when submitting form via WWW::Mechanize
by jerrygarciuh (Curate) on Jul 02, 2004 at 18:11 UTC
    Thx. neerage. I am afraid it doesn't solve problem. Appreciate the reply! --jg
    "The man who grasps principles can successfully select his own methods.
    The man who tries methods, ignoring principles, is sure to have trouble.
    ~ Ralph Waldo Emerson

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2018-05-25 22:49 GMT
Find Nodes?
    Voting Booth?