With PHP it might be quite easy. PHP comes with support for FTP built in, IIRC.
Even if it doesn't, you just need your script to fire off a program like ncftp, or wget (Comes with Linux, but there's Windows versions of both too); they're programs that run in the background downloading files, and more importantly, they're command line so can be configured completely through command line parameters. That should work fine.