可以使用带有 Curl (Philip Sturgeon) 库的 CURLOPT_FILE 下载文件吗?
现在我正在使用,它可以工作,但我想用 Curl 库来做:
set_time_limit(0);
ini_set('display_errors',true);//Just in case we get some errors, let us know....
$fp = fopen ('/Users/tony/labs/store/'. 'a.mp4', 'w+');//This is the file where we save the information
$ch = curl_init($previewUrl);//Here is the file we are downloading
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
curl_close($ch);
fclose($fp);
我想要这样的东西:
$file = fopen($to, 'w');
$this->curl->create($url);
$this->curl->option('file', $file);
$this->curl->execute();
fclose($file);