ASP 獲取騰訊IP地址的代碼
更新時(shí)間:2010年04月12日 14:22:07 作者:
ASP 獲取騰訊IP地址的代碼 用ASP來存儲,從上面讀取出來的數(shù)據(jù)。
提問:
<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來存儲,從上面讀取出來的數(shù)據(jù)呢。
回答:
<%
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
'函數(shù)名:BytesToBstr
'作用:轉(zhuǎn)換二進(jìn)制數(shù)據(jù)為字符
'參數(shù):Body-二進(jìn)制數(shù)據(jù),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獲取真實(shí)IP):"&split(TempStr,"""")(1)" " &split(TempStr,"""")(5)" "&replace(split(TempStr,"""")(7),"市","")
%>
復(fù)制代碼 代碼如下:
<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來存儲,從上面讀取出來的數(shù)據(jù)呢。
回答:
復(fù)制代碼 代碼如下:
<%
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
'函數(shù)名:BytesToBstr
'作用:轉(zhuǎn)換二進(jìn)制數(shù)據(jù)為字符
'參數(shù):Body-二進(jìn)制數(shù)據(jù),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獲取真實(shí)IP):"&split(TempStr,"""")(1)" " &split(TempStr,"""")(5)" "&replace(split(TempStr,"""")(7),"市","")
%>
相關(guān)文章
asp HTTP_X_FORWARDED_FOR和REMOTE_ADDR
HTTP_X_FORWARDED_FOR與REMOTE_ADDR的區(qū)別.2009-04-04Asp函數(shù)介紹(37個(gè)常用函數(shù))
下面的函數(shù)是asp中經(jīng)常用的到呢,大家可以收藏一下經(jīng)常查詢下2008-11-11asp通過JMAIL實(shí)現(xiàn)通用發(fā)送函數(shù)
asp通過JMAIL實(shí)現(xiàn)通用發(fā)送函數(shù)...2007-08-08