How do I save the google image map API picture to my server

前端 未结 4 2237
别跟我提以往
别跟我提以往 2020-12-14 04:23

Is it possible to save the google map image API as an image to my server?

Background: Google map image API is generating an image of the desired loc

4条回答
  •  忘掉有多难
    2020-12-14 05:02

    you can easily read that url using file_get_contents

    snippet for this will be

    $url='http://maps.googleapis.com/maps/api/staticmap?center=15719+OAKLEAF+RUN+DRIVE%2CLITHIA%2CFL%2C33547%2CUS&zoom=8&size=150x100&markers=color:blue|label:S|11211&sensor=false';
    
    file_put_contents('filename.png',file_get_contents($url));
    

提交回复
热议问题