»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 06-06-2003, 11:50 AM   #1 (permalink)
Registered User
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 3,962
Creatures is on a distinguished road
Send a message via ICQ to Creatures
Need a Script (loading pic)

i'm new in programming Perl so i cant do much (nearly nothing )

but i need a program which downloads once a day a pic from a site and save it on my server (so i dont have to hotlink the pic and i dont have to do it manually)

anyone knows how to program or where i could find one?

Creatures

__________________
___)
(
____)REATURES
Creatures is offline   Reply With Quote
Old 06-06-2003, 03:24 PM   #2 (permalink)
Registered User
 
gothic's Avatar
 
Join Date: Oct 2001
Location: Palatine, IL
Posts: 375
gothic is on a distinguished road
What kind of server?
Is the pic always the same filename?

If filenames differ, is the surrounding code the same?

If you can supply the site with the picture you want to yank, I can give you a short program to do it.
gothic is offline   Reply With Quote
Old 06-06-2003, 04:02 PM   #3 (permalink)
Registered User
 
SpookyEddy's Avatar
 
Join Date: Oct 2001
Location: UK
Posts: 3,125
SpookyEddy is on a distinguished road
If the filename and path is static you could just grab it with wget and set a cron job to run every day (or do something similar if its not a unix box). If you really want to use perl then I will gladly help if you describe the problem in more detail.

Regards

eddy
SpookyEddy is offline   Reply With Quote
Old 06-06-2003, 06:04 PM   #4 (permalink)
Registered User
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 3,962
Creatures is on a distinguished road
Send a message via ICQ to Creatures
it's always on the same place and same name

so anyone is a coder? i'm just too bad

Creatures
__________________
___)
(
____)REATURES
Creatures is offline   Reply With Quote
Old 06-06-2003, 09:59 PM   #5 (permalink)
Registered User
 
gothic's Avatar
 
Join Date: Oct 2001
Location: Palatine, IL
Posts: 375
gothic is on a distinguished road
Heck, if it's the same place and same filename, you might as well follow Spooky's suggestion with using 'wget'. Assuming you are on a *nix OS.

'wget -q -t 3 -O yourfilename.png http://somedomain.com/somefile.png'
gothic is offline   Reply With Quote
Old 06-06-2003, 10:05 PM   #6 (permalink)
Registered User
 
gothic's Avatar
 
Join Date: Oct 2001
Location: Palatine, IL
Posts: 375
gothic is on a distinguished road
Now for the PERL code:
*edit* -- This code requires LWP, which you can get from cpan.org or if you are lucky enough to run Debian, you can get it from apt.. =]
Code:
#!/usr/bin/perl -w -T
my $file = "yourfile.png";
my $remotefile = "http://somedomain.com/somefile.png";


use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("PERLFoo/0.1 " . $ua->agent);
$result = "";

$doc = new HTTP::Request GET => $remotefile;
$doc->content_type('application/x-www-form-urlencoded');
$doc->content('match=www&errors=0');
$result = $ua->request($doc);

if ($result->is_success) {
 open TEMP, ">$file";
 print TEMP $result->content;
 close TEMP;
} else {
 print "Error downloading: $remotefile\n";
}
gothic is offline   Reply With Quote
Old 06-07-2003, 01:50 AM   #7 (permalink)
Registered User
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 3,962
Creatures is on a distinguished road
Send a message via ICQ to Creatures
ok gonna try out, thx for your coder skills

Creatures
__________________
___)
(
____)REATURES
Creatures is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 04:31 PM.