http://www.perlmonks.org?node_id=979345


in reply to problem web xml file

hmm well I got it worked out I think. thanks for all the help!

sub g_zip { my $file = $_; my $data; my $ptr = new IO::Uncompress::Gunzip($file) or die $!; while (defined (my $line = $ptr->getline())) { $data .= $line; } $ptr->close(); return $data; }

Replies are listed 'Best First'.
Re^2: problem web xml file
by ig (Vicar) on Jul 02, 2012 at 05:51 UTC

    There's nothing wrong with unzipping it yourself, but another option is to use LWP::UserAgent and let it handle the decoding.

    #!C:/strawberry/perl/bin/perl.exe # use strict; use warnings; use LWP::UserAgent; my $url = 'http://atys.ryzom.com/api/character.php?key=FR521366R0REA16 +F998&part=items'; my $ua = LWP::UserAgent->new(); my $response = $ua->get($url); if($response->is_success) { print $response->decoded_content; } else { die $response->status_line; }