PHP calls Google Maps

Source: Internet
Author: User
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.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.