'用ServerXMLHTTP从ip138获取IP地址    
    Dim WinHttpReq    
    Set WinHttpReq = CreateObject("Msxml2.ServerXMLHTTP")    
    WinHttpReq.Open "GET", "
http://www.ip138.com/ips1388.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)       
    MsgBox Matches.Item(0).Value
	
posted on 2010-11-05 21:16 
张志松 阅读(2231) 
评论(1)  编辑 收藏 引用  所属分类: 
VB/VBS