注意禁止使用Webbrowser控件真实访问网站后获取,也不可以使用Inet控件,有什么其他方法吗?

解决方案 »

  1.   

    '此代码由“正则测试工具 v1.1.33”自动生成,请直接调用TestReg过程
    Private Sub TestReg()
        Dim strData As String
        Dim reg As Object
        Dim matchs As Object    strData = getHtmlStr("http://www.baidu.com/")    Set reg = CreateObject("vbscript.regExp")
        reg.IgnoreCase = True
        reg.Pattern = "<title>(.*)</title>"
        Set matchs = reg.Execute(strData)
        If matchs.Count > 0 Then MsgBox matchs(0).SubMatches(0)
    End SubPrivate Function getHtmlStr(strUrl As String) As String
        Dim XmlHttp As Object
        Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
        XmlHttp.Open "GET", strUrl, False
        XmlHttp.send
        getHtmlStr = StrConv(XmlHttp.ResponseBody, vbUnicode)
        Set XmlHttp = Nothing
    End Function
      

  2.   

    使用winsock获取网页源码,然后拿返回的数据用楼上的
    哦,难道winsock也禁止使用?