提問:
復(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來存儲(chǔ),從上面讀取出來的數(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),"市","")
%>
您可能感興趣的文章:- 以IP來獲取客戶端電腦名稱(一句代碼實(shí)現(xiàn))
- ASP.NET獲取真正的客戶端IP地址的6種方法
- 獲取客戶端電腦日期時(shí)間js代碼(jquery)
- IP138 IP地址查詢小偷實(shí)現(xiàn)代碼
- asp.net 通過指定IP地址得到當(dāng)前的網(wǎng)絡(luò)上的主機(jī)的域名
- asp.net DZ論壇中根據(jù)IP地址取得所在地的代碼
- 獲取客戶端IP地址c#/vb.net各自實(shí)現(xiàn)代碼