php 获取客户端所在城市地址

来源:互联网 发布:软件开发第一步 编辑:程序博客网 时间:2024/05/22 01:59
<?php    /** * php获取ip地址以及所在城市,使用腾迅的api接口 *  */    header("content-type:text/html; charset=gb2312");    function get_ip_place(){        $ip=file_get_contents("http://fw.qq.com/ipaddress");             $ip=str_replace('"',' ',$ip);         $ip2=explode("(",$ip);            $a=substr($ip2[1],0,-2);        $b=explode(",",$a);        return $b;        }            $ip=get_ip_place();    echo "<pre>";                 print_r($ip);    ?>   


原创粉丝点击