Created
August 9, 2014 19:54
-
-
Save saltun/169673af65c1c9554cdb to your computer and use it in GitHub Desktop.
Curl Dosya indirme
This file contains 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 dosya_indir($link,$dosya_adi=NULL){ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,$link); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
$dosya=curl_exec($ch); | |
curl_close($ch); | |
if($dosya_adi==NULL){ | |
$dosya_adi=explode("/",$link); | |
$dosya_adi=array_reverse($dosya_adi); | |
$dosya_adi=$dosya_adi[0]; | |
} | |
$fp = fopen($dosya_adi,'w'); | |
fwrite($fp, $dosya); | |
fclose($fp); | |
} | |
dosya_indir("http://saltun.net/savascanaltun.png","dosyadi.png"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment