加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

ASP 取得腾讯IP地址的代码

发布时间:2023-07-03 13:38:53 所属栏目:Asp教程 来源:
导读:ASP 取得腾讯IP地址的代码:代码如下:<script type=text/javascript src=http://fw.qq.com/ipaddress></script><script type=text/javascript>var hehe1=IPData[2]var hehe2=IPData[3]alert(hehe1);alert(hehe2);doc

ASP 取得腾讯IP地址的代码:

代码如下:

<script type=text/javascript src=http://fw.qq.com/ipaddress></script>

<script type=text/javascript>

var hehe1=IPData[2]

var hehe2=IPData[3]

alert(hehe1);

alert(hehe2);

document.write(IPData.join(' '));

</script>

如何用ASP来存储,从上面读取出来的数据呢。

回答:

代码如下:

<%

function GetResStr(URL,code)

err.clear

dim Http,ReturnStr

Set Http=server.createobject("Microsoft.XMLHTTP")

Http.open "GET",URL,False

Http.Send()

If Http.Readystate =4 Then

If Http.status=200 Then

ReturnStr=BytesToBstr(http.responseBody,code)

GetResStr=ReturnStr

End If

End If

End Function

'函数名:BytesToBstr

'作用:转换二进制数据为字符

'参数:Body-二进制数据,Cset-文本编码方式

Function BytesToBstr(Body,Cset)

Dim Objstream

Set Objstream = Server.CreateObject("adodb.stream")

objstream.Type = 1

objstream.Mode =3

objstream.Open

objstream.Write body

objstream.Position = 0

objstream.Type = 2

objstream.Charset =Cset

BytesToBstr = objstream.ReadText

objstream.Close

set objstream = nothing

End Function

dim vUrl,TempStr

vUrl="http://fw.qq.com/ipaddress"

TempStr=GetResStr(vUrl,"gb2312")

response.write "您的IP为(asp获取真实IP):"&split(TempStr,"""")(1)" " &split(TempStr,"""")(5)" "&replace(split(TempStr,"""")(7),"市","")

%>

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章