1. Before using Google API, we need to apply for a key first and add it to the end of the URL as a unique identifier.
2. There is an address in the Google Maps API that can be used to query detailed information of a certain location, for example, querying Beijing: http://maps.google.com/maps/geo?q=beijing
3. We can also query Add a parameter after the above address to let it output the data we want. For example, if we need csv data, then the address becomes http://maps.google.com/maps/geo?q=beijing&output=csv
4 . In this way, we get 4 pieces of data. The first is the http return address, the second is the accuracy, and the last two are coordinates. If we know the left side, we can locate a certain point. So how do we get it? What about the following data? Let me write a program below.
Copy the code The code is as follows:
$url = "http://maps.google.com/maps/geo?q=beijing&output=csv";
$con = file_get_contents($url);
$arr = explode(",",$con);
The above introduces the google map api code for adding GOOGLE map function to IP query, including the content of google map api. I hope it will be helpful to friends who are interested in PHP tutorials.