PHP call GoogleMap?
PHP calls GoogleMap, and according to the client sends the latitude and longitude display location, how to implement? PHP
------Solution--------------------
Http://wenku.baidu.com/view/704d821ea76e58fafab003b0.html
------Solution--------------------
Simple, like this, Google's existing code, but need to share the user's geographic location to Google.
Https://google-developers.appspot.com/maps/documentation/javascript/examples/map-geolocation
Complex point, you need to have an IP latitude and longitude packet. But little for free, like: http://www.maxmind.com/en/geolocation_landing
and then use
function Curip () {
$ip = ";
if (getenv (' http_client_ip ') and strcasecmp (getenv (' http_client_ip '), ' unknown ') {
$ip =getenv (' http_client_ip ');
}elseif (getenv (' http_x_forwarded_for ') and strcasecmp (getenv (' http_x_forwarded_for '), ' unknown ')) {
$ip =getenv (' http_x_forwarded_for ');
}elseif (getenv (' remote_addr ') and strcasecmp (getenv (' remote_addr '), ' unknown ')) {
$ip =getenv (' remote_addr ');
}elseif (Isset ($_server[' REMOTE_ADDR ']) and $_server[' REMOTE_ADDR '] and strcasecmp ($_server[' remote_addr '), ' Unknown ')) {
$ip =$_server[' remote_addr '];
}else{
$ip = ' 127.0.0.1 ';
}
return $IP;
}
Get the User IP address, and then convert from the database to latitude and longitude, fill in the Google Map JS code.