473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

help: downloading online files with perl

kk
Hi,
I am trying to write a script that downloads a file from a website everyday.
Can I just use the copy command (i.e. use File::Copy)? Does it support URI?
I wrote something like below, but it does not seem to work.

use File::Copy;
copy(www.abc.com\abc.pdf, "C:\myfolder\") or die "File cannot be copied.";

Is there a better way to do this?

Sorry, it seems like a very easy thing to do, but I am doing something
wrong...

Thank you
Dec 24 '06 #1
2 2689
kk wrote:
I am trying to write a script that downloads a file from a website
everyday.
Your Question is Asked Frequently:
"How do I fetch an HTML file?"
Can I just use the copy command (i.e. use File::Copy)?
No.
Does it support URI?
Well, of course not. A URI can be anything, not just a simple file.
I wrote something like below, but it does not seem to
work.
use File::Copy;
copy(www.abc.com\abc.pdf, "C:\myfolder\") or die "File cannot be
copied.";
Is there a better way to do this?
Yes. As explained in the FAQ.

jue
Dec 25 '06 #2

"kk" <ab*@abc.comwrote in message
news:45**********************@roadrunner.com...
Hi,
I am trying to write a script that downloads a file from a website
everyday. Can I just use the copy command (i.e. use File::Copy)? Does it
support URI? I wrote something like below, but it does not seem to work.

use File::Copy;
copy(www.abc.com\abc.pdf, "C:\myfolder\") or die "File cannot be copied.";

Is there a better way to do this?

Sorry, it seems like a very easy thing to do, but I am doing something
wrong...

Thank you
Have a look at LWP (lib-www-perl). You'll probably need to do an HTTP
request, but it supports ftp, gopher and local file systems using this
module. I haven't tried this with what you're trying to do so I don't have
any examples, but I have used LWP to retrieve HTTP pages.

Craig
Jan 10 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: FLOTServer | last post by:
Here's my problem: I run a gameserver that runs the game "Medal of Honor". On the game server is log file which contains all of the data from the players for that day (kills, deaths, etc...). I...
0
by: sales | last post by:
If you are having difficulty downloading large files, please check out www.Downloads4Dialups.com. Mention this newsgroup in the "Special Instructions" window on the Shipping Form, and receive a...
6
by: Tony K | last post by:
I have the most peculiar problem with an ASP.NET page which we use for downloading a file. When the user clicks on a link, the link points to an ASPX page which downloads the file selected. ...
4
by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading...
4
by: c83 | last post by:
I am using Active Perl, and i-am having problems downloading files from internet because of the proxy. The script is workin when no proxy is present, but now it refuses to download files. Here is...
4
rajiv07
by: rajiv07 | last post by:
Hi To all, I have a script for downloading file from the server.The Problem is when i try to download WMA file it get download but it is not playing.when i try to play this file in Windows Media...
1
by: andrewwan1980 | last post by:
I need help in parsing unicode webpages & downloading jpeg image files via Perl scripts. I read http://www.cs.utk.edu/cs594ipm/perl/crawltut.html about using LWP or HTTP or get($url) functions &...
11
by: bthalapathi | last post by:
I have written a script to connect the mysql db #!/usr/bin/perl -w use DBI; #definition of variables $db="MYTEST"; $host="localhost"; $user="root"; $password="rootpass";
9
by: Archanak | last post by:
Hi, I wanted to download some online data from some site so i used perl LWP module. code i wrote was like this: use LWP; use LWP::UserAgent; $ua=new LWP::UserAgent;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.