腾讯地图IP定位api: https://lbs.qq.com/service/webService/webServiceGuide/webServiceIp
$ip = $_SERVER["REMOTE_ADDR"]; //获取客户端IP
//echo $ip;
$url = 'https://apis.map.qq.com/ws/location/v1/ip?key=腾讯地图key&ip='.$ip;
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_ENCODING ,'gb2312');
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ; // 获取数据返回
$result = curl_exec($ch);
curl_close($ch);
$result = json_decode($result);
//print_r($result);
//获取经纬度
$lat = $result->result->location->lat;
$lng = $result->result->location->lng;
echo $lat.','.$lng;