Page 1 of 1
Need a script that downloads files from FTP automatically
Posted: Wed Sep 01, 2010 6:15 pm
by Glamophonic
Hi there!
I am not much into PHP or programming and stuff, but I just had an idea and wanted to know if that is possible to do!
What I wanna do is "install" or use a PHP script that automatically downloads X files from a FTP every X minutes and uploads them on another server! I guess that mustn't be difficult, but I have no idea! The other part I want to do (I guess this is more difficult) is, once X files are uploaded on the second server (not the original), create a page where everyone can download those files.
Sorry if I didn't explain myself well, but I suck at english!
Thanks in advance!!

Re: Need a script that downloads files from FTP automaticall
Posted: Wed Sep 01, 2010 6:21 pm
by Gargoyle
won'T be much of a problem, just you will have use cron to call the PHP script as it can't magically spring to life on its own.
Re: Need a script that downloads files from FTP automaticall
Posted: Wed Sep 01, 2010 6:27 pm
by Glamophonic
Gargoyle wrote:won'T be much of a problem, just you will have use cron to call the PHP script as it can't magically spring to life on its own.
What's a cron?

Re: Need a script that downloads files from FTP automaticall
Posted: Wed Sep 01, 2010 6:28 pm
by Gargoyle
Re: Need a script that downloads files from FTP automaticall
Posted: Wed Sep 01, 2010 6:32 pm
by Glamophonic
Wow, thanks!!!
And how can I use it with PHP?
:/
Sorry for all these stupid questions but I know nothing about PHP/Cron!
Re: Need a script that downloads files from FTP automaticall
Posted: Wed Sep 01, 2010 6:39 pm
by shawngoldw
Glamophonic wrote:And how can I use it with PHP?
When you set up cron you just tell it to run a specified script every X time interval. You just set that script to be a php file.
Re: Need a script that downloads files from FTP automaticall
Posted: Wed Sep 01, 2010 6:49 pm
by Glamophonic
shawngoldw wrote:Glamophonic wrote:And how can I use it with PHP?
When you set up cron you just tell it to run a specified script every X time interval. You just set that script to be a php file.
How do I get that script (not cron) and where do I install it? I have found some online tutorials but I don't get anything at all
Thanks for your help!!
Re: Need a script that downloads files from FTP automaticall
Posted: Wed Sep 01, 2010 7:44 pm
by shawngoldw
There is no "that script". You would need to write "that script" to do what you want. Then cron can take care of running it for you ever X minutes.
Now, since you said you are not much into programming this will be much more difficult to do

But yes, it is possible.
Shawn
Re: Need a script that downloads files from FTP automaticall
Posted: Wed Sep 01, 2010 7:59 pm
by Glamophonic
shawngoldw wrote:There is no "that script". You would need to write "that script" to do what you want. Then cron can take care of running it for you ever X minutes.
Now, since you said you are not much into programming this will be much more difficult to do

But yes, it is possible.
Shawn
:/ Thanks!
I'm def giving up! LOL
Re: Need a script that downloads files from FTP automaticall
Posted: Thu Sep 02, 2010 12:28 am
by shawngoldw
No problem, if you decide to give the script a shot, feel free to ask around here if/when you get stuck

Re: Need a script that downloads files from FTP automaticall
Posted: Thu Sep 02, 2010 11:02 am
by timWebUK
http://php.net/manual/en/book.ftp.php
This may be of use to you. The PHP manual entry for FTP, containing all the functions you could call. Your script would need to contain several parts:
- A connection to the a server
- A get command to retrieve the file
- Store that file locally/temporarily
- A connection to the other server
- A 'put' command to send the local file you just download
If you are running on a Linux-based operating system you would then set up a 'crontab' file, which would contain the location of the script, and it will run it at intervals you specify. As you said you don't know much programming, this is would be a great challenge to get into PHP and learn your way around. Also a good Linux exercise.
Don't give up.