Stamm has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to download KeyForge images from the official site with a Perl program. Here is what I got:
use 5.010; use strict; use warnings; use LWP::UserAgent; my $url = "https://cdn.keyforgegame.com/media/card_front/en/341_1_7C85 +4VPW72RH_en.png"; my $ua = LWP::UserAgent->new(agent => ''); my $response = $ua->get($url); die $response->status_line if not $response->is_success; my $data = $response->content; say $data;
Then I start the program with:
perl test.pl > test.pngThe resulting file can't unfortunately be opened by applications (error: bad format). I tried to diff my file with the one downloaded with a browser and it shows 8 differences. I'm not used to diff binary files but it seems maybe there's a CRLF conversion somewhere. I'm on Windows by the way.
Could someone help me?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Downloading KeyForge image
by afoken (Chancellor) on May 21, 2019 at 18:57 UTC | |
by Stamm (Sexton) on May 21, 2019 at 19:10 UTC | |
by poj (Abbot) on May 21, 2019 at 20:43 UTC | |
by Stamm (Sexton) on May 21, 2019 at 21:07 UTC | |
by poj (Abbot) on May 21, 2019 at 21:15 UTC | |
by afoken (Chancellor) on May 21, 2019 at 20:00 UTC | |
|
Re: Downloading KeyForge image
by Fletch (Bishop) on May 21, 2019 at 18:57 UTC |