Transfer File on different server Transfer File on different server curl curl

Transfer File on different server


You can accomplish this with PHP FTP.Make sure you have correct permissions to write files on the servers.

Download File using cURL :

set_time_limit(0); // unlimited max execution time for big files$options = array(  CURLOPT_FILE    => '/path/download/file/server1.img',  CURLOPT_TIMEOUT =>  28800, // set this to 8 hours so we dont timeout on big files  CURLOPT_URL     => 'http://server2.com/path/download/file/server2.img',);$ch = curl_init();curl_setopt_array($ch, $options);curl_exec($ch);curl_close($ch);


For this you can use any CDN hosting providers like Rackspace or any other.Actually I have used Rackspace were we uploaded files, kept storage separate from the code.They provide you API to upload,delete,retrieve files even you can create directories. They provide you API key and secret key which is used to make API call.While implementing this make common functions which can be used throughout the project to do this operations.