久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

用API獲取IP地址

 陌瑾花開(kāi) 2018-09-10
  • 設(shè)計(jì)蜂巢IP地址查詢接口:http://www./api/ip/ip.php
  • 騰訊IP地址查詢接口:http://fw.qq.com/ipaddress
  • 新浪IP地址查詢接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js
  • 搜狐IP地址查詢接口:http://pv.sohu.com/cityjson
  • 谷歌IP地址查詢接口:http://j./app/geoip.js
  • 有道IP地址查詢接口:http://www.youdao.com/smartresult-xml/search.s
  • 1616 IP地址查詢接口:http://w./chaxun/iptolocal.php
  • 126 http://ip.ws.126.net/ipquery
  • hao123 http://app.hao123.com/ipquery/getcity.php?rtype=2

設(shè)計(jì)蜂巢接口調(diào)用方法

API請(qǐng)求地址 : http://www./api/ip/ip.php?參數(shù)

參數(shù)說(shuō)明:

  • IP : IP地址 可選
  • format : 輸出格式 json 可選 默認(rèn)為JS

JSON調(diào)用示例:
請(qǐng)求地址:http://www./api/ip/ip.php?callback=jQuery17107324279078748077_1327024991339&format=json&_=1327024991363

{
“ip”: “117.89.35.58″,
“province”: “\u6c5f\u82cf”,
“city”: “\u5357\u4eac”
}

騰訊接口調(diào)用方法

  1. <script src="http://fw.qq.com/ipaddress"></script>
  2. <script type="text/javascript">
  3. //反回格式如下:
  4. //var IPData = new Array("117.89.35.98","","江蘇省","南京市");
  5. console.log(IPData[0]+','+IPData[2]+','+IPData[3]) //117.89.35.98,江蘇省,南京市
  6. </script>
該方法已經(jīng)不可用,,訪問(wèn)http://fw.qq.com/ipaddre顯示“The page you are looking for is temporarily unavailable.Please try again later.”,。騰訊對(duì)Referer做了判斷,雖然可以通過(guò)PHP偽造Referer,,但是實(shí)際測(cè)試中獲得的是服務(wù)器的IP地址而不是客戶端的IP地址。我們一起鄙視一下騰訊,。

新浪接口調(diào)用方法

  1. <script src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js"></script>
  2. <script type="text/javascript">
  3. //format參數(shù)設(shè)置返回格式 js/json
  4. //ip 要查詢IP 可選
  5. //反回格式如下:
  6. //var remote_ip_info = {"ret":1,"start":"117.89.35.0","end":"117.89.35.255","country":"\u4e2d\u56fd","province":"\u6c5f\u82cf","city":"\u5357\u4eac","district":"\u767d\u4e0b","isp":"\u7535\u4fe1","type":"","desc":""};
  7. console.log(remote_ip_info["country"]+','+remote_ip_info["province"]+"省"+','+remote_ip_info["city"]+"市")//中國(guó),江蘇省,南京市
  8. </script>

搜狐接口調(diào)用方法

  1. <script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
  2. <script type="text/javascript">
  3. //默認(rèn)為GBK可通過(guò)ie參數(shù)設(shè)置編碼
  4. console.log(returnCitySN["cip"]+','+returnCitySN["cname"])//117.89.35.98,江蘇省南京市
  5. </script>

谷歌接口調(diào)用方法

據(jù)說(shuō)是谷歌的,,不知道是不是真的。

  1. <script src="http://j./app/geoip.js"></script>
  2. <script type="text/javascript">
  3. console.log(geoip_country_name()+','+geoip_region_name()+','+geoip_city())//China,Jiangsu,Nanjing
  4. </script>

有道接口調(diào)用方法

調(diào)用接口示例:http://www.youdao.com/smartresult-xml/search.s?type=ip&q=123.233.157.9

返回XML數(shù)據(jù)

<?xml version="1.0" encoding="gbk"?>
<smartresult>
<product type="ip">
<ip>123.233.157.9</ip>
<location>山東省濟(jì)南市 網(wǎng)通</location>
</product>
</smartresult>

或者

http://www.youdao.com/smartresult-xml/search.s?jsFlag=true&keyfrom=163.com&event=fYodaoCallBack&type=ip&q=192.168.1.1

返回JSON數(shù)據(jù)

fYodaoCallBack(1, {‘product’:'ip’,'ip’:’192.168.1.1′,’location’:'局域網(wǎng) 對(duì)方和您在同一內(nèi)部網(wǎng)’} , ”);






單獨(dú)寫(xiě)一個(gè)新浪的


  1.  // 新浪根據(jù)ip獲取地址  
  2.    var province = '' ;  
  3.    var city = '' ;  
  4.   jQuery.getScript("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js",function(){  
  5.      province = remote_ip_info["province"];  
  6.      city = remote_ip_info["city"];    
  7.   
  8.     }) ;   
在加個(gè)方法返回當(dāng)前省份的省會(huì)或者直轄市名稱
//判斷當(dāng)前城市的省會(huì)
 function SwitchCity(province) {
     var city = "";
     if (province.indexOf("河北") != -1) {
         city = "石家莊";
         return city;
     } else if (province.indexOf("山西") != -1) {
         city = "太原";
         return city;
     } else if (province.indexOf("遼寧") != -1) {
         city = "沈陽(yáng)";
         return city;
     } else if (province.indexOf("吉林") != -1) {
         city = "長(zhǎng)春";
         return city;
     } else if (province.indexOf("山西") != -1) {
         city = "太原";
         return city;
     } else if (province.indexOf("黑龍江") != -1) {
         city = "哈爾濱";
         return city;
     } else if (province.indexOf("江蘇") != -1) {
         city = "南京";
         return city;
     } else if (province.indexOf("浙江") != -1) {
         city = "杭州";
         return city;
     } else if (province.indexOf("福建") != -1) {
         city = "福州";
         return city;
     } else if (province.indexOf("江西") != -1) {
         city = "南昌";
         return city;
     } else if (province.indexOf("山東") != -1) {
         city = "濟(jì)南";
         return city;
     } else if (province.indexOf("河南") != -1) {
         city = "鄭州";
         return city;
     } else if (province.indexOf("廣東") != -1) {
         city = "廣州";
         return city;
     } else if (province.indexOf("湖南") != -1) {
         city = "長(zhǎng)沙";
         return city;
     } else if (province.indexOf("海南") != -1) {
         city = "???;
         return city;
     } else if (province.indexOf("四川") != -1) {
         city = "成都";
         return city;
     } else if (province.indexOf("貴州") != -1) {
         city = "貴陽(yáng)";
         return city;
     } else if (province.indexOf("云南") != -1) {
         city = "昆明";
         return city;
     } else if (province.indexOf("陜西") != -1) {
         city = "西安";
         return city;
     } else if (province.indexOf("臺(tái)灣") != -1) {
         city = "臺(tái)北";
         return city;
     } else if (province.indexOf("內(nèi)蒙古") != -1) {
         city = "呼和浩特";
         return city;
     } else if (province.indexOf("廣西") != -1) {
         city = "南寧";
         return city;
     } else if (province.indexOf("西藏") != -1) {
         city = "拉薩";
         return city;
     } else if (province.indexOf("寧夏") != -1) {
         city = "銀川";
         return city;
     } else if (province.indexOf("新疆") != -1) {
         city = "烏魯木齊";
         return city;
     } else if (province.indexOf("上海") != -1) {
         city = "上海";
         return city;
     } else if (province.indexOf("重慶") != -1) {
         city = "重慶";
         return city;
     } else if (province.indexOf("北京") != -1) {
         city = "北京";
         return city;
     } else if (province.indexOf("天津") != -1) {
         city = "天津";
         return city;
     }
     return city;
 } 

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多