我用inet获取网站数据,使用以下代码,但经常获取到的数据为空,网络和网站都正常,不知道还有什么问题,请DX帮忙:
Private Sub Command1_Click()
    Dim url As String, getStr As String
    url = "http://www.163.com"
    For i = 0 To 100
        WaitInet Inet1
        Inet1.Execute url, "post", ""
        getStr = InetGetChunk(Inet1)
        If getStr = "" Then debug.print "无法获取网站数据"
    Next
End Sub
Public Sub WaitInet(ByRef CtlInet As Inet)
    Err.Clear
    While CtlInet.StillExecuting
        DoEvents
    Wend
End SubPublic Function InetGetChunk(ByRef CtlInet As Inet) As String
    Dim TmpStr As String: TmpStr = ""
    While CtlInet.StillExecuting
        DoEvents
    Wend
    TmpStr = CtlInet.GetChunk(1024, icString) & ""
    While TmpStr <> ""
        InetGetChunk = InetGetChunk & TmpStr
        TmpStr = CtlInet.GetChunk(1024, icString) & ""
    Wend
    
End Function