深山工作室

深山工作室 >

通过阿里云服务接口获得ip地址详细信息

Dim ip,datatype,token,url


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

'Get内容
Function geturl_diy(url,d_biaoqian,xml2)
dim http
set http=server.createobject("Msxml2.ServerXMLHTTP")
http.open "GET",url,false
http.setRequestHeader "If-Modified-Since","0"
http.setRequestHeader "Authorization","APPCODE b2519882bc354febb205fdd660dd4fbf" '增加特别标识
http.send()
geturl_diy=http.responsetext
'GetURL=bytesToBSTR(http.responseBody,"gb2312")
geturl_diy=BytesToBstr(http.responseBody,"utf-8")
set http=nothing
End Function

ip_url = "https://api01.aliyun.venuscn.com/ip?ip=44.227.127.2"   '阿里云用来解析IP信息的网址
strJson = geturl_diy(url,"ali_getip","")

'以下是获得的内容
'{"data":{"ip":"44.227.127.2","long_ip":"753106690","isp":"Amazon","area":"","region_id":"","region":"","city_id":"","city":"波特兰","country_id":"US","country":"美国"},"ret":200,"msg":"success","log_id":"4e00b3aeca8f4763ab26f0fbb6eee9d7"}

'测试演示使用的
'j_txtsrc = "iptest.txt"
'strJson = ReadFromTextFile(Server.MapPath(""& j_txtsrc &""),"utf-8")


Call InitScriptControl:Set objTest = getJSONObject(strJson)
if objTest.msg="success" then
guojia = objTest.data.country '国家
guojia_id = objTest.data.country_id '国家编号
shengfen = objTest.data.region '省份
chengshi = objTest.data.city '城市
diqu = objTest.data.area '地区
yunyingshang = objTest.data.isp 'isp
end if

Response.Write objTest.msg & "___<br>"
Response.Write strJson & "___<br>"
Response.Write guojia & "___<br>"
Response.Write guojia_id & "___<br>"
Response.Write shengfen & "___<br>"
Response.Write chengshi & "___<br>"
Response.Write diqu & "___<br>"
Response.Write yunyingshang & "___<br>"
response.end


前一页:iis点开后任务栏上有显示,但是窗口看不到的解决办法
后一页:asp显示随机密码
更多>>ASP相关信息
ASP中Utf-8与Gb2312编码转换乱码问题的解决方法页面编码声明
asp显示随机密码
通过阿里云服务接口获得ip地址详细信息
iis点开后任务栏上有显示,但是窗口看不到的解决办法
RSA加密解密插件
更多>>最新添加
dw里面查找替换使用正则删除sqlserver里面的CONSTRAINT
Android移动端自动化测试:使用UIAutomatorViewer与Selenium定位元素
抖音直播音挂载小雪花 懂车帝小程序
javascript获取浏览器指纹可以用来做投票
火狐Mozilla Firefox出现:无法载入您的Firefox配置文件 它可能已经丢失 或是无法访问 问题解决集合处理办法