function getFacebookPhoto($img,$fullpath) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_URL, $img);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
$user_curl_image = curl_exec($curl);
curl_close($curl);
if(file_exists($fullpath)){
@unlink($fullpath);
}
$fp = fopen($fullpath,'x');
fwrite($fp, $user_curl_image);
fclose($fp);
}
这是我用来下载照片的脚本。这样做是否正确?
我在 Facebook 应用程序中使用此功能。