Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Problem with LWP::UserAgent

by Paradigma (Novice)
on Jun 23, 2019 at 12:23 UTC ( #11101752=note: print w/replies, xml ) Need Help??


in reply to Re: Problem with LWP::UserAgent
in thread Problem with LWP::UserAgent

my $ua = LWP::UserAgent->new( 'agent' => 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537 +.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36' ); my $res = $ua->get($url, 'Content-Length' => 0, 'Accept-Encoding' => ' +gzip'); if ($res->is_success) { my $tree = HTML::TreeBuilder::XPath->new_from_content(Compress::Zlib +::memGunzip($res->content())); ... ... }

^^ This doesn't work either

Replies are listed 'Best First'.
Re^3: Problem with LWP::UserAgent
by bliako (Prior) on Jun 23, 2019 at 12:39 UTC

    The code holli posted works for me just fine. Adding the gzip encoding to the headers also works fine but it works without it as well. The code you posted last works if replace Compress::Zlib::memGunzip($res->content()) with $res->decoded_content

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2020-11-30 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?