0
我正在開發中PHP
web服務,我生成一個網址爲google static maps
例如:PHP從谷歌地圖獲取文件,並將其返回
http://maps.googleapis.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&sensor=false
我需要得到png
圖像和回報它作爲圖像:
$fullURL = 'http://maps.googleapis.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&sensor=false';
$img = file_get_contents($fullURL);
header("Content-Type: image/png");
header("Content-Length: " . filesize($img));
echo $img;
,當我在瀏覽器中運行谷歌的網址我看到的圖像與獲得:
但是當我跑我的網頁上面我的代碼看不到圖像,它的大小是不同的:
如何做到這一點嗎?
(我的服務假設返回與google原始網址相同的png文件)。