I'm developing a leecher website using PHP and cURL.
Here is the basic code:
$ch = curl_init();
$url = "http://somesite.com/somefile.part1.rar";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$file_name = basename($url);
$output = curl_exec($ch);
curl_close($ch);
file_put_contents($file_name, $output);
When the file size is small (like 15MB or so) this code works and the file is leeched to my server but when the file size is big (like 1GB or so) nothing is working.
I've tried setting 10000M file size limit for: post_max_size upload_max_filesize max_file_uploads but that didn't work.
I've tried to increase the memory limit up to 512M or even -1, but that didn't work ether.
So how can I fetch large files using cURL?