How to make the Curl run?

1

I'm using a curl to download a file ... but there's a problem that when the user refreshes the page or uploads the download continues in the background. How do I stop the download from running ?!

$url = 'http://www.sitelab.combr.co/backup.rar';


$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$fp = fopen('backup.rar', 'w');
            curl_setopt($ch, CURLOPT_FILE, $fp);


$result = curl_exec($ch);
curl_close($ch);
fclose($fp);
if(!$result){
                echo 'False';
                exit;
            }else{
                echo 'True';
                exit;
            }
    
asked by anonymous 29.03.2017 / 00:32

0 answers