20 HAZİRAN 2011, PAZARTESİ
İndirme büyük bir dosya curl kullanarak
Uzak dosya curl kullanarak indirmek istiyorum.
İşte ben örnek kod:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$st = curl_exec($ch);
$fd = fopen($tmp_name, 'w');
fwrite($fd, $st);
fclose($fd);
curl_close($ch);
Ama bellek onu okur, çünkü büyük dosyaları işlemek.
Doğrudan diske dosya stream mümkün mü?
CEVAP
20 HAZİRAN 2011, PAZARTESİ
<?php
set_time_limit(0);
$fp = fopen (dirname(__FILE__) . '/localfile.tmp', 'w ');//This is the file where we save the information
$ch = curl_init(str_replace(" "," ",$url));//Here is the file we are downloading, replace spaces with
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp); // write curl response to file
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch); // get curl response
curl_close($ch);
fclose($fp);
?>
Bunu Paylaş:
Kullanarak birden fazla dosya ile daha...
Asp.Net herhangi bir tür dosya indirme...
ASP.NET Web API bir yöntem angularjs k...
İndirme için bir dosya PHP kullanarak ...
Python kullanarak bir dosya var olup o...