smilingsagar has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; use LWP::Simple; use WWW::Mechanize; use Compress::Zlib; # Create a new instance of WWW::Mechanize my $mechanize = WWW::Mechanize->new(autocheck => 1); $mechanize->cookie_jar(HTTP::Cookies->new); my $url = 'http://documents-dds-ny.un.org/doc/UNDOC/GEN/N08/588/39/pdf +/N0858839.pdf?OpenElement'; my $file = 'test.pdf'; #getstore($url,$file); $mechanize->cookie_jar(HTTP::Cookies->new); $mechanize->get($url); my $response = $mechanize->response(); for my $key ( $response->header_field_names() ) { print $key, " : ", $response->header( $key ), "\n"; } my $dest = $mechanize->response->content; if($mechanize->response->header("Content-Encoding") eq "gzip") { $dest = Compress::Zlib::memGunzip($dest); $mechanize->update_html($dest); } $mechanize->get($url,":content_file" => $file); print $mechanize->content();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Mechanize - Header Help required.
by Anonymous Monk on Jan 30, 2010 at 22:44 UTC | |
by Gavin (Archbishop) on Jan 31, 2010 at 11:21 UTC | |
|
Re: Perl Mechanize - Header Help required.
by Anonymous Monk on Jan 30, 2010 at 18:29 UTC | |
by smilingsagar (Initiate) on Jan 31, 2010 at 02:40 UTC | |
by Anonymous Monk on Jan 31, 2010 at 03:21 UTC | |
by smilingsagar (Initiate) on Jan 31, 2010 at 04:10 UTC | |
by Anonymous Monk on Jan 31, 2010 at 04:44 UTC | |
|