圖片抓取
$url=$_GET["url"];
get_img($url);
/**
* 獲取遠程圖片
* @param $url 圖片URL
*/
function get_img($url){
$ext=pathinfo($url,PATHINFO_EXTENSION);
$ext_arr = explode("?",$ext);
$ext=$ext_arr[0];
if($ext=='jpg' || $ext=='gif' || $ext=='png' || $ext=='jpeg' || $ext=='bmp'){
header('Content-type: image/'.$ext);
}else{
header('Content-type: image/jpg');
}
echo file_get_contents($url);
}