http協議:
http://api.youripapi.com/ip/
https協議:
https://api.youripapi.com/ip/
* API接口可能會因為各種網絡原因和攻擊都可能産生阻斷,請開發時做好冗餘和異常處理
* 當HTTP請求返回的狀態碼非200時,請做異常處理,比如 202 狀態碼造成的原因可能是無效Token、餘額不足、格式錯誤
ASP調用iP查詢接口示例:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% Option Explicit
'=========================================================
' File : .asp
' Version : 1.0.0.0
' Create :
' Modify :
'=========================================================
' 1.0.0.0 :
'========================================================= %>
<% Dim ip,datatype,token,url
ip = "117.25.13.123"
datatype = "txt"
token = "00d5cb1fac5dc5cbfe2ff218292a2dfd33" '用戶中心查看您的token
url = "https://api.youripapi.com/ip/?ip="&ip&"&datatype="&datatype&"&token="&token
Response.Write (GetURL(url))
Function GetURL(url)
on error resume next
dim Retrieval
Set Retrieval = Server.CreateObject("MSXML2.ServerXMLHTTP")
Retrieval.setTimeouts 600000, 600000, 600000, 600000
Retrieval.Open "GET", url, false
Retrieval.Send
GetURL = Retrieval.ResponseBody
Set Retrieval = Nothing
GetURL=BytesToBstr(GetURL,"utf-8")
End Function
Function BytesToBstr(strBody,CodeBase)
dim objStream
set objStream = Server.CreateObject("Adodb.Stream")
objStream.Type = 1
objStream.Mode =3
objStream.Open
objStream.Write strBody
objStream.Position = 0
objStream.Type = 2
objStream.Charset = CodeBase
BytesToBstr = objStream.ReadText
objStream.Close
set objStream = nothing
End Function
%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% Option Explicit
'=========================================================
' File : .asp
' Version : 1.0.0.0
' Create :
' Modify :
'=========================================================
' 1.0.0.0 :
'========================================================= %>
<% Dim ip,datatype,token,url,strMid,oid,sign
ip = "117.25.13.123"
strMid = 777 '用戶中心查看您的mid
oid = 777 '用戶中心查看您的oid
datatype = "txt"
token = "00d5cb1fac5dc5cbfe2ff218292a2dfd33" '用戶中心查看您的token
url = "https://api.youripapi.com/ip/?"
sign = MD5_32("ip="&ip&"&token="&token)
%>
<script type="text/javascript">
</script>
<script type="text/javascript" src="<%= url&"ip="&ip&"&callback=find&mid="&strMid&"&oid="&oid&"&sign="&sign %>"></script>