I would like to use a Php Script with cURL library to download one directory name datas ( with one .xml and one .txt.zip file ) which is inside my ftp server #1 into my ftp server #2 . This directory should be download every 24 hours.

Is it possible to do this with cURL ?


What you're asking for isn't strictly a "download" for you to do.

If I understand you correctly, what you want to do is download the file from FT Server #1 then upload the file to FTP Server #2. There isn't a direct way to tell one server to transfer it to the other...

...unless you have access to run programs on the servers themselves (i.e. if you're the admin or you have ssh/php access to one of the actual server computers). THEN you could download a file from FTP Server #1 to the local computer (which is FTP Server #2).


I do something like that regarding my VPS and I do it using multcloud.com. They offer 2TB of traffic free and 10TB if you share it on social media. You can set up recurring transfers on it. I used to use mover.io but now it is a paid option.

Best regards.

PS:- If this isn't what you're looking for, please comment and let me know. I don't know anything about cURL so I can't answer that part of your question.


I cannot comment to answer you… That's so problematic… Anyway i have tried to use file_get_contents and file_put_contents which is allow by my host.

    /* FTP SERVEUR #1)
    $contents = file_get_contents("ftp://username:pass@directory/file.xml");

    file_put_contents("ftp://username:pass@directory/file.xml", $contents);


I execute this I don't see any file.xml coming into my #2 and i don't have any error ! I have try to do echo($contents) and it works. The problem is coming with the file_put_contents.

EDIT: This works if you set the permissions of your destination directory inside server #2 to 777.

Not the answer you're looking for? Browse other questions tagged or ask your own question.