Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 imbibing at the Monastery: (13)
As of 2014-12-19 14:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (84 votes), past polls