function put_file_from_url_content($url, $saveName = 'tmp.png', $path = './Uploads/Tmp/') {
set_time_limit ( 0 );
$url = trim ( $url );
$curl = curl_init ();
curl_setopt ( $curl, CURLOPT_URL, $url );
curl_setopt ( $curl, CURLOPT_HEADER, 0 );
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 1 );
$file = curl_exec ( $curl );
curl_close ( $curl );
$filename = $path . $saveName;
$write = @fopen ( $filename, "w" );
if ($write == false) {
return false;
}
if (fwrite ( $write, $file ) == false) {
return false;
}
if (fclose ( $write ) == false) {
return false;
}
return $filename;
}
本文转自TBHacker博客园博客,原文链接:http://www.cnblogs.com/jiqing9006/p/5731626.html,如需转载请自行联系原作者