I am trying to download a video file directly on my server using the bellow php-curl script, but it stops downloading after getting around 120mb of file, the files are more than 500mb and some of them are 1gb and 1.5gb in size. I searched a lot but got nothing to resolve. I am running on a shared hosting.
if ($url) {
    $file_loc = 'moviez/' . $name;
    $fp = fopen($file_loc, 'w+');
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_TIMEOUT, 0);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
}
 
     
     
     
    