Skip to content

Instantly share code, notes, and snippets.

@saltun
Created August 9, 2014 19:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save saltun/169673af65c1c9554cdb to your computer and use it in GitHub Desktop.
Save saltun/169673af65c1c9554cdb to your computer and use it in GitHub Desktop.
Curl Dosya indirme
<?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