Curl file Downloader

İlgili Konular: Php

PHP'de curl kütüphanesiyle sunucunuza 200kb hizla dosya çekebilirsiniz.

<?
error_reporting(0);
function utime (){
$time = explode( " ", microtime());
$usec = (double)$time[0];
$sec = (double)$time[1];
return $sec + $usec;
}
if(!function_exists('curl_init')){
die("cURL Extension, PHP'de Yüklü Degildir. Lütfen Yükleyin.");
}
$downloaddir = "./downloaded";
if(!is_dir($downloaddir)){
if(!mkdir( $downloaddir )){
die("Download Dizini Yok ve Olusturulamiyor. Lütfen Manuel Olarak Olusturun, ve CHMOD 777 Atin.");
} else {
chmod($downloaddir, "0777") or die("CHMOD 777 Yapilamadi. Manuel Olarak Yapiniz!");
}
}
if(isset($_GET['submit'])){
echo"<h3>cURL Dosya Indirici</h3><hr>";
$file = $_POST['file'];
if($file[4] != ":" || $file[5] != "/" || $file[6] != "/" ) {
$file = "http://".$file;
}
if($file[0].$file[1].$file[2].$file[3] == "file"){
die("Bu Script, Local URL'ler Ile Çalismak Üzere Ayarlanmamistir.");
}
$do = parse_url($file);
$xx = $do['path'];
$xy = pathinfo($xx);
$locfn = $xy['basename'];
$locpth = $downloaddir."/".$locfn;
if(file_exists($locpth)){
unlink($locpth) or die($locpath." Mevcut ve Dosya Overwrite Edilemiyor, Dosya Adini Degistirin yada Silin.");
echo $locpth."Dosyasi Mevcut. Overwrite Ediliyor.<br>";
}
flush();
$start = utime();
$curl = curl_init($file);
ob_start();
curl_exec($curl);
$contents = ob_get_contents();
ob_end_clean();
$handle = fopen($locpth, "a+");
fwrite($handle, $contents);
fclose($handle);
$end = utime();
$run = $end - $start;
echo"Dosyaniz, Download Basarili Oldu Ise, ".$locpth." Dosyasina Kayit Edildi.<br>";
echo round(filesize($locpth), 0)."byte Dosya, " . round($run, 0) . " Saniyede Indirildi(".round(filesize($locpth)/round($run, 0), 0)."bps).<br>";
} else {
?>
<h3>cURL Dosya Indirici</h3><hr>
<form action='<? echo $_SERVER['PHP_SELF']; ?>?submit=1' method='post'>
Dosya URL'si Giriniz: <input type='text' name='file'><input type='submit' name='submit' value='Download'><input type='reset' value='Sifirla'>
</form>
<?
}
?>

Yeni yorum veya soru gönder

Bu alanın içeriği gizlenecek, genel görünümde yer almayacaktır.
  • Glossary terms will be automatically marked with links to their descriptions. If there are certain phrases or sections of text that should be excluded from glossary marking and linking, use the special markup, [no-glossary] ... [/no-glossary]. Additionally, these HTML elements will not be scanned: a, abbr, acronym, code, pre.
  • Eklediğiniz bağlantılara rel="nofollow" eklenerek, eklediklerinizin arama motorları tarafından bu site üzerinden indexlenmesi engellenir.

  • You may insert videos with [video:URL]

Biçimlendirme seçenekleri hakkında daha fazla bilgi


CAPTCHA
Bu soru sizin gerçek bir ziyaretçi olup olmadığınızı anlamak için sorulmaktadır..
CAPTCHA resmi
Resimdeki karakterleri giriniz.