Created
April 17, 2011 19:09
-
-
Save melihbuyuk/924368 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sistem_geri_bildirim($bildirim_kodu, $onem, $mesaj, $mesaj_kodu, $indirilen, $boyut) { | |
switch($bildirim_kodu) { | |
case STREAM_NOTIFY_RESOLVE: | |
case STREAM_NOTIFY_AUTH_REQUIRED: | |
case STREAM_NOTIFY_COMPLETED: | |
case STREAM_NOTIFY_FAILURE: | |
case STREAM_NOTIFY_AUTH_RESULT: | |
var_dump($bildirim_kodu, $onem, $mesaj, $mesaj_kodu, $indirilen, $boyut); | |
break; | |
case STREAM_NOTIFY_REDIRECTED: | |
echo "Su Adrese Yonlendirildi: ", $mesaj."<br />"; | |
break; | |
case STREAM_NOTIFY_CONNECT: | |
echo "Baglaniyor..."; | |
break; | |
case STREAM_NOTIFY_FILE_SIZE_IS: | |
echo "Toplam Dosya Boyutu: ", $boyut."<br />"; | |
break; | |
case STREAM_NOTIFY_MIME_TYPE_IS: | |
echo "Bulunan Dosya Tipi: ", $mesaj."<br />"; | |
break; | |
case STREAM_NOTIFY_PROGRESS: | |
if ($indirilen > 0) { | |
if (!isset($boyut)) { | |
printf("\rDosya Boyutu Hesaplanamiyor.. %2d kb Indirildi..", $indirilen/1024); | |
} else { | |
$uzunluk = (int)(($indirilen/$boyut)*100); | |
printf("\r[%-100s] %d%% (%2d/%2d kb)<br />", str_repeat("=", $uzunluk). ">", $uzunluk, ($indirilen/1024), $boyut/1024); | |
} | |
} | |
break; | |
} | |
echo "\n"; | |
} | |
$ctx = stream_context_create(); | |
stream_context_set_params($ctx, array("notification" => "sistem_geri_bildirim")); | |
file_get_contents("http://melihbuyuk.com/demo.zip", false, $ctx); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment