Greetings Monks.
I am trying to create an HTTP request to an ordinary jpg on a website and return and print it.
Instead of an image, I am seeing what appears to be binary data. I have scoured various online websites to try and remedy this. I figured maybe it's a header issue, or perhaps I need to decode or otherwise modify the binary to some viewable format, but all has been to no avail.
Here is the code:
#!perl use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $server_endpoint = "http://upload.wikimedia.org/wikipedia/en/7/70/B +logscope-logo-simple.jpg"; my $req = HTTP::Request->new(GET => $server_endpoint); $req->header('content-type' => 'image/jpeg'); my $resp = $ua->request($req); if ($resp->is_success) { my $message = $resp->content; print $message; }
I appreciate your time and help with this matter! Thanks!
In reply to Difficulty with using LWP to display JPEG by Aquilae
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |