php根据IP获取所有地,腾讯IP API
http://www.phplike.com/web/php/269.html
本人是寫php的,所以會關心用php獲取所有地。
<?php
function getIpPlace(){
$ip=file_get_contents("http://fw.qq.com/ipaddress");
$ip=str_replace('"',' ',$ip);
$ip=explode("(",$ip);
$ip=substr($ip[1],0,-2);
$ip=explode(",",$ip);
return $ip;
}
$ip=getIpPlace();
foreach($ip as $value)
{
echo iconv('GB2312','utf-8',$value); /*避免中文亂碼,因為騰訊IP API是GB2312格式,而本人需要UTF-8*/
}
?>
新浪的IP地址查詢接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js
新浪多地域測試方法:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=12.130.132.30
搜狐IP地址查詢接口(默認GBK):http://pv.sohu.com/cityjson
搜狐IP地址查詢接口(可設置編碼):http://pv.sohu.com/cityjson?ie=utf-8
搜狐另外的IP地址查詢接口:http://txt.go.sohu.com/ip/soip
JS版:javascript根據IP獲取所有地,騰訊IP API??
總結
以上是生活随笔為你收集整理的php根据IP获取所有地,腾讯IP API的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VB.NET程序如何巧妙释放内存
- 下一篇: 正则表达式——获取指定IP的物理地址