Google Maps - converting address to latitude & longitude - PHP backend?

后端 未结 4 1426
自闭症患者
自闭症患者 2021-01-02 01:09

is it possible to convert (in PHP back-end):


to

         


        
4条回答
  •  孤城傲影
    2021-01-02 01:28

    Yes you can. You would do a request with file_get_contents or curl to a url like this:

    http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false

    What is returned is a json encoded response. You can parse this into arrays using json_decode.

    The documentation page has an example of the what the response may look like, use that to find the data that you need.

提交回复
热议问题