Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Download image from URL

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
jastim
Asked:
jastim
1 Solution
 
rj2Commented:
0
 
kblack05Commented:
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
 
kblack05Commented:
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
 
SegFaultCommented:
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
 
jmcgOwnerCommented:
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now