Php calls googlemap? Php & nbsp; how does one call googlemap and display the location based on the longitude and latitude sent by the client? Php, http://wenku.baidu.com/view/704d821ea76e php calls googlemap?
How does php call googlemap and display the location based on the longitude and latitude sent by the client? Php
------ Solution --------------------
Http://wenku.baidu.com/view/704d821ea76e58fafab003b0.html
------ Solution --------------------
In this case, the existing code of google needs to share the geographical location of the user to google.
Https://google-developers.appspot.com/maps/documentation/javascript/examples/map-geolocation
Complex, you need an IP address with a latitude and longitude data packet. But few are free, like: http://www.maxmind.com/en/geolocation_landing
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;
}
Obtain the user IP address, convert it from the database to the longitude and latitude, and fill in the JS code of google map.