Home >php教程 >php手册 >根据IP查询经纬度

根据IP查询经纬度

WBOY
WBOYOriginal
2016-06-07 11:36:003588browse

根据本地IP查询接口查询出经纬度与当前路径
 //通过接口获取所在地址IP<br>         public function is_where(){<br>             header("content-type:text/html;charset=utf8");<br>             $content = file_get_contents("http://api.map.baidu.com/location/ip?ak=7IZ6fgGEGohCrRKUE9Rj4TSQ&ip={$getIp}&coor=bd09ll");<br>             //echo $getIp;die;<br>             $json = json_decode($content);<br> <br>             $arr = array($json->{'content'}->{'point'}->{'x'},$json->{'content'}->{'point'}->{'y'}, $json->{'content'}->{'address'});//按层级关系提取经度数据<br>             return json_encode($arr);<br>         }<br>         

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn