There should be no problem to download files dynamically via FTP and user/password authentication. But what if using an http proxy in between?
Well, there are some useful options you may set with
One more thing to mention is that if no file for downloading is given (e.g. ftp.server.com/file_to_download) the current folder will be parsed. Looking at the received data you will maybe a bit confused, because the data format is html. CUROPT_FTPLISTONLY for example won’t work, either.
Here a small example:
$curl = curl_init(); //proxy curl_setopt($curl, CURLOPT_PROXY, “proxy.server.com”); curl_setopt($curl, CURLOPT_PROXYPORT, “80”); //ftp-server curl_setopt($curl, CURLOPT_URL, “ftp://user:firstname.lastname@example.org:21”); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); curl_close($curl); //get filenames from html preg_match_all("!< A.*? HREF=\"([^\"]*)\"[^>]*>(.*?)</A>!", $result, $return);