asp获取IP
<%
'用ServerXMLHTTP从ip138获取IP地址
Dim WinHttpReq
Set WinHttpReq = CreateObject("Msxml2.ServerXMLHTTP")
WinHttpReq.Open "GET", "http://www.ip138.com/ip2city.asp"
WinHttpReq.Send
'正则表达式解析出外网IP
Dim MyRegExp
Set MyRegExp = CreateObject("VBScript.RegExp")
MyRegExp.Pattern = "((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)"
MyRegExp.IgnoreCase = True
MyRegExp.Global = True
Dim Matches
Set Matches = MyRegExp.Execute(WinHttpReq.ResponseText)
%>
<%=Matches.Item(0).Value%>