php通过调用腾讯的API接口返回IP所有在城市名称
<?php /* 调用腾讯的API接口 返回结果 var IPData = new Array("114.238.55.147","","江苏省","淮安市"); 0 为 IP地址 1 为 null 2 为 省份 3 为 城市 */ function get_ip_place(){ $ip = file_get_contents ( "http://fw.qq测试数据/ipaddress" ); $ip = str_replace ( '"' , ' ' , $ip ); $ip2 = explode ( "(" , $ip ); $a = substr ( $ip2 [1],0,-2); $b = explode ( "," , $a ); return $b ; } $ip =get_ip_place(); print_r( $ip ); print_r( $ip [0]); // 这个就是你当前外网IP地址 print_r( $ip [2]); // 这个就是你所在的省份 print_r( $ip [3]); //这个就是你所在的城市了 ?>查看更多关于php通过调用腾讯的API接口返回IP所有在城市名称的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did30888