/ Published in: PHP
This can save your life if you need 2 servers to have the same data with 1 upload
Expand |
Embed | Plain Text
/** * cURL file copy to another server * This file saved my life when i had to let a file upload synchrom to a different server, no ftp messing around! */ $rCurl = curl_init(); /** * The file to copy */ curl_setopt($rCurl, CURLOPT_URL, 'http://www.google.nl/intl/nl_nl/images/logo.gif'); /** * cURL options dunno what for */ curl_setopt($rCurl, CURLOPT_HEADER, false); /** * cURL options dunno what for */ curl_setopt($rCurl, CURLOPT_BINARYTRANSFER, true); /** * cURL options dunno what for */ curl_setopt($rCurl, CURLOPT_RETURNTRANSFER, true); /** * The php file limit */ /** * set cURL timeout */ curl_setopt($rCurl, CURLOPT_TIMEOUT, 300); /** * The file that will be written */ /** * Setup the transfer ? */ curl_setopt($rCurl, CURLOPT_FILE, $outfile); /** * Execute the transfer */ curl_exec($rCurl); /** * Close the file */ /** * Close cURL */ curl_close($rCurl);
You need to login to post a comment.
