LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-31-2006, 08:00 AM   #1
rigel_kent
Member
 
Registered: Nov 2004
Posts: 64

Rep: Reputation: 15
Get a remote image with Perl


Hi,

I want to download some jpegs files from an http url; if I use "get" and print the output to a file with a jpeg extension no image appears (all is black with stripes).

How can I do this?

Cheers,

Rigel_Kent
 
Old 08-31-2006, 08:33 AM   #2
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
The following works fine here:
Code:
#!/usr/bin/perl -w

use LWP::UserAgent;

my $ua = new LWP::UserAgent;

my $response = $ua->get( 'http://www.jpeg.org/images/sky_main.jpg' );

open( FILE, "> image.jpg");
print FILE $response->content();
close FILE;
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
difference netween linux-image and kernel image? mariogarcia Linux - Software 2 06-19-2006 08:01 AM
perl emailing html with embedded image davesbedroom Programming 2 06-01-2005 10:49 AM
PERL question about getting input of current root window image joesbox Programming 3 01-02-2004 02:15 PM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
perl script to insert image information rhuser Programming 1 03-12-2003 05:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration