视频下载与PHP卷曲

I have to download large videos with curl. Cause the site where I download from put 403 blocks, And I can pass thru with only Curl. Thats my php curl function code. I need this with the download but it shouldnt eat up my memory..

function fakeip()
{
//return long2ip( mt_rand(0, 65537) * mt_rand(0, 65535) ); 
return "127.0.0.1";
}
    function curlx($feed,$coo=null,$ref=null)
{

        $ch = curl_init();
        $timeout = 0;
        curl_setopt ($ch, CURLOPT_URL, $feed);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: ".fakeip(),"X-Client-IP: ".fakeip(),"Client-IP: ".fakeip(),"HTTP_X_FORWARDED_FOR: ".fakeip(),"X-Forwarded-For: ".fakeip()));
        curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0');
        //curl_setopt($ch, CURLOPT_INTERFACE, "88.150.225.55");
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_FAILONERROR, true); 
        if(!empty($coo))
        {
            curl_setopt($ch, CURLOPT_COOKIEFILE, $coo);
            curl_setopt($ch, CURLOPT_COOKIEJAR, $coo);
        }
        if(empty($ref))
        {
            curl_setopt($ch, CURLOPT_REFERER,$feed);
        }
        else
        {
            curl_setopt($ch, CURLOPT_REFERER,$ref);
        }
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $veri= curl_exec($ch);
        curl_close($ch);
         return str_replace(array("
", "\t", "",), null, $veri); 
}