Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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 = "https://secure.secret.com/login/login.cfm?someParam=foo"; $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.


Comment on Re: HTTP::Headers error when submitting form via WWW::Mechanize
Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://371312]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2015-07-05 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls