function downloadfile($url, $path, $proxy = NULL)
{
    $ch = curl_init($url); if($proxy)
     curl_setopt($ch, CURLOPT_PROXY, $proxy);
    //curl_setopt ($ch, CURLOPT_URL, $url);
    
    $fp = fopen($path, "w");
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, 0);    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    return $path;
}
该函数用于将url的内容存于path文件中,但存在一个问题就是,有时会因为某url的网络状况不好而将整个程序阻塞!
所以,想知道curl有没有异步模式,有的话如何改进这个函数?
谢谢了先!