Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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]
[erix]: yeah, but there is a lot SQLite cannot do :)
[hippo]: Database is the 2nd column.
shmem .oO( docker. docker. docker? docker. docker! docker )
[shmem]: at least, some Ook.
[erix]: another simple Pg thing is to running a database off a tsv (alas, readonly)
[erix]: I'm waiting for that zipfile-reading to show up in DBD::SQLite :)
[Corion]: hippo, erix: That sounds promising :)
[Corion]: erix: I misinterpreted that. It only allows to read a zipfile like a table, not reading a database from a zipfile :-(
shmem is grabbed by nostalgia for Bolivia
[erix]: aah, ok.

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2018-02-23 15:18 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (302 votes). Check out past polls.