ASPはテンセントのIPアドレスのコードを取得します

1785 ワード

質問:
 
  

<br>var hehe1=IPData[2] <br>var hehe2=IPData[3] <br>alert(hehe1); <br>alert(hehe2); <br>document.write(IPData.join(' ')); <br>

どのように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)," ","")
%>