我在Classic ASP中有以下代码:
Dim objHttp, strQuery
strQuery = "https://geoip.maxmind.com/f?333l=2112212&i=" & ipaddress
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "GET", strQuery, false
objHttp.send
Response.Write objHttp.ResponseText
Set objHttp = Nothing
这是来自MAxMind的API,用于获取每个IP的用户的城市/邮编。它正在运作,但我得到了这样一条很长的路线:
US,CA,Los Angeles,90068,34.134499,-328.190804,673,818,“AT& T U-verse”
我知道如何打破这一行并从中获取某些值?
答案 0 :(得分:6)
theArray = Split(objHttp.ResponseText,",")
for i=0 to uBound (theArray)
response.write theArray(i)
next
试试吧。如果字符串始终采用相同的格式,则只需说出theArray(3)