美文网首页
常用免费API接口

常用免费API接口

作者: 最底层的技术渣 | 来源:发表于2019-05-22 13:35 被阅读0次
1、根据ip查询一些情况

淘宝:http://ip.taobao.com/service/getIpInfo.php?ip=8.8.8.8

{
    "code": 0,
    "data": {
        "ip": "8.8.8.8",
        "country": "美国",
        "area": "",
        "region": "XX",
        "city": "XX",
        "county": "XX",
        "isp": "Level3",
        "country_id": "US",
        "area_id": "",
        "region_id": "xx",
        "city_id": "xx",
        "county_id": "xx",
        "isp_id": "200053"
    }
}

搜狐:http://txt.go.sohu.com/ip/soip

String.prototype.getQueryString = function(v) {
    var reg = new RegExp("(^|&|\\?)" + v + "=([^&]*)(&|$)"),
        r;
    if (r = this.match(reg)) {
        return unescape(r[2]);
    }
    return null;
};
var sohu_IP_Loc = "unknown",
    LocUrl = document.location.href;
if ((LocUrl.indexOf("sohusce.com") >= 0) || (LocUrl.indexOf("sohu.com") >= 0) || (LocUrl.indexOf("chinaren.com") >= 0) || (LocUrl.indexOf("17173.com") >= 0) || (LocUrl.indexOf("focus.cn") >= 0)) {
    window.sohu_user_ip = "110.87.109.3";
    sohu_IP_Loc = "CN350200";
    sohu_IP_Loc_V = "CN350200";
}
var AdLoc2 = sohu_IP_Loc.substr(0, 2),
    AdLoc4 = sohu_IP_Loc.substr(0, 4),
    AdLoc6 = sohu_IP_Loc.substr(0, 6);
if (window.location.href.getQueryString("ip")) sohu_IP_Loc = AdLoc2 = AdLoc4 = AdLoc6 = window.location.href.getQueryString("ip");

搜狐:http://pv.sohu.com/cityjson?ie=utf-8

var returnCitySN = {"cip": "110.87.109.32", "cid": "350200", "cname": "福建省厦门市"};

相关文章

网友评论

      本文标题:常用免费API接口

      本文链接:https://www.haomeiwen.com/subject/xatgoqtx.html