WIKI使用導(dǎo)航
站長百科導(dǎo)航
站長專題
- 網(wǎng)站推廣
- 網(wǎng)站程序
- 網(wǎng)站賺錢
- 虛擬主機(jī)
- cPanel
- 網(wǎng)址導(dǎo)航專題
- 云計(jì)算
- 微博營銷
- 虛擬主機(jī)管理系統(tǒng)
- 開放平臺
- WIKI程序與應(yīng)用
- 美國十大主機(jī)
預(yù)訂寶/IP地址歸屬地查詢系統(tǒng)
來自站長百科
IP地址歸屬地查詢系統(tǒng)基于著名的純真IP數(shù)據(jù)庫實(shí)現(xiàn),預(yù)訂寶提供該實(shí)用工具的API是因?yàn)镮P查詢系統(tǒng)實(shí)現(xiàn)簡單,容易理解,適合開發(fā)者入門學(xué)習(xí)之用。
實(shí)際上,并不建議開發(fā)者使用該API來查詢IP地址,如果生產(chǎn)環(huán)境需要此功能,應(yīng)當(dāng)在本地程序中自行實(shí)現(xiàn)查詢效率更高、穩(wěn)定性更好的功能。
接口概述[ ]
- 接口地址:http://api.yudingbao.net/v1.0/generictools/ipsearcher.ashx
- 說明:調(diào)用本接口可以查詢IP地址的歸屬地信息。
- 鑒權(quán)方式:本接口使用密鑰標(biāo)記鑒權(quán),不嚴(yán)格要求調(diào)用者的身份。使用本接口需要申請實(shí)用工具授權(quán)。
- 響應(yīng)模式:JSON、JSONP、XML
獲取版本信息[ ]
- 調(diào)用方式:GET
- 動(dòng)作:getVersion
- 參數(shù):無
示例代碼[ ]
請求示例
<!--請求示例,該接口的訪問類同于如下表單的提交,請留意URL中的"act"參數(shù)--> <form id="myForm" method="post" action="http://api.yudingbao.net/v1.0/generictools/ipsearcher.ashx"> <p> <input id="act" name="act" value="getVersion" type="text" /> </p> <p> <!--指定響應(yīng)格式為XML,這里以XML為例--> <input id="format" name="format" value="xml" type="text" /> <!--指定響應(yīng)體應(yīng)當(dāng)是已格式化的,便于閱讀代碼,在生產(chǎn)環(huán)境中應(yīng)當(dāng)將該值設(shè)置為false--> <input id="indent" name="indent" value="true" type="text" /> <!--產(chǎn)品編號。在我的賬戶-分銷產(chǎn)品的應(yīng)用列表中可以找到該參數(shù)的值。--> <input id="aid" name="aid" value="78663" type="text" /> <!--接口密鑰。在我的賬戶-分銷產(chǎn)品的應(yīng)用列表中可以找到該參數(shù)的值。--> <input id="key" name="key" value="f9308fe421092586ff7897bc26d9b88178e5607195c9a8df6c2a226c6589fa1b" type="text" /> <!--應(yīng)用程序授權(quán)編號及公鑰,這是可選的--> <input id="sid" name="sid" value="" type="text"> <input id="sKey" name="sKey" value="" type="text"> </p> <p> <input id="submit" name="submit" type="submit" value="提交" /> </p> </form>
XML響應(yīng)
<!--XML響應(yīng)--> <?xml version="1.0" encoding="utf-8"?> <HttpResponse> <Status type="number">0</Status> <Messages type="array"> </Messages> <ResponseBody type="object"> <FileName type="string">QQWry.DAT</FileName> <Copyright type="string">純真網(wǎng)絡(luò)</Copyright> <UpdateTime type="string">Sun, 04 May 0042 16:00:00 GMT</UpdateTime> <RecordCount type="number">424032</RecordCount> </ResponseBody> </HttpResponse>
JSON響應(yīng)
// Json響應(yīng) { "Status" : 0, "Messages" : [], "ResponseBody" : { "FileName" : "QQWry.DAT", "Copyright" : "純真網(wǎng)絡(luò)", "UpdateTime" : Date(1304524800000), "RecordCount" : 424032 } }
JSONP響應(yīng)
// JsonP響應(yīng) jsoncallback({ "Status" : 0, "Messages" : [], "ResponseBody" : { "FileName" : "QQWry.DAT", "Copyright" : "純真網(wǎng)絡(luò)", "UpdateTime" : Date(1304524800000), "RecordCount" : 424032 } });
查詢IP地址[ ]
- 調(diào)用方式:POST
- 動(dòng)作:query
- 參數(shù):見參數(shù)說明
參數(shù)說明[ ]
參數(shù)名稱 | 參數(shù)類型 | 說明 |
---|---|---|
ipaddress | array | 一個(gè)數(shù)組。包含要查詢的IP地址的字符串形式的集合。 |
例如:[ '192.168.1.1', '215.216.12.34' ] |
示例代碼[ ]
請求示例
<!--請求示例,該接口的訪問類同于如下表單的提交,請留意URL中的"act"參數(shù)--> <form id="myForm" method="post" action="http://api.yudingbao.net/v1.0/generictools/ipsearcher.ashx"> <p> <input id="act" name="act" value="query" type="text" /> </p> <p> <input id="ipaddress1" name="ipaddress" value="192.168.1.1" type="text"> <input id="ipaddress2" name="ipaddress" value="202.104.228.23" type="text"> <input id="ipaddress3" name="ipaddress" value="10.3.45.20" type="text"> <input id="ipaddress4" name="ipaddress" value="8.8.8.8" type="text"> <input id="ipaddress5" name="ipaddress" value="8.8.4.4" type="text"> <input id="ipaddress6" name="ipaddress" value="211.222.233.244" type="text"> </p> <p> <!--指定響應(yīng)格式為XML,這里以XML為例--> <input id="format" name="format" value="xml" type="text" /> <!--指定響應(yīng)體應(yīng)當(dāng)是已格式化的,便于閱讀代碼,在生產(chǎn)環(huán)境中應(yīng)當(dāng)將該值設(shè)置為false--> <input id="indent" name="indent" value="true" type="text" /> <!--產(chǎn)品編號。在我的賬戶-分銷產(chǎn)品的應(yīng)用列表中可以找到該參數(shù)的值。--> <input id="aid" name="aid" value="78663" type="text" /> <!--接口密鑰。在我的賬戶-分銷產(chǎn)品的應(yīng)用列表中可以找到該參數(shù)的值。--> <input id="key" name="key" value="f9308fe421092586ff7897bc26d9b88178e5607195c9a8df6c2a226c6589fa1b" type="text" /> <!--應(yīng)用程序授權(quán)編號及公鑰,這是可選的--> <input id="sid" name="sid" value="" type="text"> <input id="sKey" name="sKey" value="" type="text"> </p> <p> <input id="submit" name="submit" value="提交" type="submit"> </p> </form>
XML響應(yīng)
<!--XML響應(yīng)--> <?xml version="1.0" encoding="utf-8"?> <HttpResponse> <Status type="number">0</Status> <Messages type="array"> </Messages> <ResponseBody type="array"> <item type="object"> <IPString type="string">192.168.1.1</IPString> <Country type="string">局域網(wǎng)</Country> <Area type="string">對方和您在同一內(nèi)部網(wǎng)</Area> <Address type="number">16885952</Address> </item> <item type="object"> <IPString type="string">202.104.228.23</IPString> <Country type="string">廣東省揭陽市</Country> <Area type="string">(棉湖)電信ADSL</Area> <Address type="number">400845002</Address> </item> <item type="object"> <IPString type="string">10.3.45.20</IPString> <Country type="string">局域網(wǎng)</Country> <Area type="string">對方和您在同一內(nèi)部網(wǎng)</Area> <Address type="number">338494218</Address> </item> <item type="object"> <IPString type="string">8.8.8.8</IPString> <Country type="string">美國</Country> <Area type="string">加利福尼亞州山景市谷歌公司DNS服務(wù)器</Area> <Address type="number">134744072</Address> </item> <item type="object"> <IPString type="string">8.8.4.4</IPString> <Country type="string">美國</Country> <Area type="string">加利福尼亞州山景市谷歌公司DNS服務(wù)器</Area> <Address type="number">67373064</Address> </item> <item type="object"> <IPString type="string">211.222.233.244</IPString> <Country type="string">韓國</Country> <Area type="string"> </Area> <Address type="number">4108967635</Address> </item> </ResponseBody> </HttpResponse>
JSON響應(yīng)
// Json響應(yīng) { "Status" : 0, "Messages" : [], "ResponseBody" : [{ "IPString" : "192.168.1.1", "Country" : "局域網(wǎng)", "Area" : "對方和您在同一內(nèi)部網(wǎng)", "Address" : 16885952 }, { "IPString" : "202.104.228.23", "Country" : "廣東省揭陽市", "Area" : "(棉湖)電信ADSL", "Address" : 400845002 }, { "IPString" : "10.3.45.20", "Country" : "局域網(wǎng)", "Area" : "對方和您在同一內(nèi)部網(wǎng)", "Address" : 338494218 }, { "IPString" : "8.8.8.8", "Country" : "美國", "Area" : "加利福尼亞州山景市谷歌公司DNS服務(wù)器", "Address" : 134744072 }, { "IPString" : "8.8.4.4", "Country" : "美國", "Area" : "加利福尼亞州山景市谷歌公司DNS服務(wù)器", "Address" : 67373064 }, { "IPString" : "211.222.233.244", "Country" : "韓國", "Area" : "", "Address" : 4108967635 }] }
JSOP響應(yīng)
// JsonP響應(yīng) jsoncallback({ "Status" : 0, "Messages" : [], "ResponseBody" : [{ "IPString" : "192.168.1.1", "Country" : "局域網(wǎng)", "Area" : "對方和您在同一內(nèi)部網(wǎng)", "Address" : 16885952 }, { "IPString" : "202.104.228.23", "Country" : "廣東省揭陽市", "Area" : "(棉湖)電信ADSL", "Address" : 400845002 }, { "IPString" : "10.3.45.20", "Country" : "局域網(wǎng)", "Area" : "對方和您在同一內(nèi)部網(wǎng)", "Address" : 338494218 }, { "IPString" : "8.8.8.8", "Country" : "美國", "Area" : "加利福尼亞州山景市谷歌公司DNS服務(wù)器", "Address" : 134744072 }, { "IPString" : "8.8.4.4", "Country" : "美國", "Area" : "加利福尼亞州山景市谷歌公司DNS服務(wù)器", "Address" : 67373064 }, { "IPString" : "211.222.233.244", "Country" : "韓國", "Area" : "", "Address" : 4108967635 }] });