''getIP set http=createobject("Microsoft.XMLHTTP") ipp="http://www.ip138.com/ip2city.asp" http.open "get",ipp,false http.send ss=bytes2BSTR(Http.responsebody) intStrA = InStr(1,ss,"[",1)+1 sss=mid(ss,intStrA) intStrB = InStr(1,sss,"]",1)-1 ss=mid(ss,intStrA,intStrB) 'wscript.echo ss
Function bytes2BSTR(vIn) strReturn = "" For i = 1 To LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) If ThisCharCode < &H80 Then strReturn = strReturn & Chr(ThisCharCode) Else NextCharCode = AscB(MidB(vIn,i+1,1)) strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) i = i + 1 End If Next bytes2BSTR = strReturn End Function