?
Solved

Download image from URL

Posted on 2003-03-17
6
Medium Priority
?
191 Views
Last Modified: 2010-03-05
Hi,
How do I download an image from URL (public site) and save it to my local disk in PERL.

ex://www.yahoo.com/file.jpg
Thanks
jasti
0
Comment
Question by:jastim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 10

Accepted Solution

by:
rj2 earned 80 total points
ID: 8153968
0
 
LVL 11

Expert Comment

by:kblack05
ID: 8155444
In case you cannot go loading server modules such as a virtual, use this method.

my $lynx = "/path/to/lynx"; # obtain with 'which lynx'
system("$lynx -dump $argv[0] >> $argv[1]");

Use like scriptname.pl http://www.somedomain.com/images/mygif.gif mygif.gif

~K Black
0
 
LVL 11

Expert Comment

by:kblack05
ID: 8155448
In case you cannot go loading server modules such as a virtual, use this method.

my $lynx = "/path/to/lynx"; # obtain with 'which lynx'
system("$lynx -dump $argv[0] >> $argv[1]");

Use like scriptname.pl http://www.somedomain.com/images/mygif.gif mygif.gif

~K Black
0
 
LVL 2

Expert Comment

by:SegFault
ID: 8158212
if you have wget, its even easier..

#!/usr/bin/perl

`wget http://www.yahoo.com/file.jpg`;


you can easily execute any shell command in perl by using the back tick operator  (upper left hand corner of the keyboard).

the stdout of the command will be put into any variable you assign.

ie $myvar = `ls`;

will get you all the files/folders in a directory
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9699444
Nothing has happened on this question in over 7 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by rj2.

Please post any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question