http://qs321.pair.com?node_id=11101752


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 (Monsignor) 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