$rand =substr(md5(uniqid(rand())),0,30);
$dosya_adi = $rand.".jpg";
$chi = curl_init("http://www.siteadresi.com/image.jpg");
$fpi = fopen("files/$dosya_adi", "w");
curl_setopt($chi, CURLOPT_REFERER, "http://www.siteadresi.com"); 
curl_setopt($chi, CURLOPT_FILE, $fpi); 
curl_setopt($chi, CURLOPT_HEADER, 0); 
curl_exec($chi); 
curl_close($chi); 
fclose($fpi);