I have a Curl Download File but The problems I have it's I need to output files with the filename where is output:
example:
$result = false;
$path = "http://mywebsite.com/download.php?file=123";
set_time_limit(0); //prevent timeout
$ch2=curl_init();
$file = fopen('upload/'.$name,'w+');
curl_setopt($ch2, CURLOPT_URL, $url);
curl_setopt($ch2, CURLOPT_FILE, $file); //auto write to file
curl_setopt($ch2, CURLOPT_TIMEOUT, 5040);
curl_setopt($ch2, CURLOPT_POST, 1);
curl_setopt($ch2, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch2, CURLOPT_SSLVERSION, 3);
curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch2);
curl_close($ch2);
fclose($file);
In my example, the I need the name of the download file is $name = (the file name)
like if I download file I can return custom_name_file.zip
but I need the writing file will the name of this custom_name_file
any idea?