Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by neeraj (Scribe)
on Jul 02, 2004 at 05:35 UTC ( [id://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.

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-19 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found