http response text fetching incomplete html

后端 未结 1 902
隐瞒了意图╮
隐瞒了意图╮ 2021-01-21 21:59

I have a code (given below) in excel vba that fetches web page source html. The code is working fine but the html that it fetches is incomplete. When the line webpageSourc

相关标签:
1条回答
  • 2021-01-21 22:43

    Debug.Print and/or the immediate window have limitations. Nowhere documented however they have.

    So try writing the webpageSource to a file:

    Sub source()
        Dim oHttp As New WinHttp.WinHttpRequest
        Dim sURL As String
        Dim webpageSource As String
        sURL = "http://www.google.com"
        oHttp.Open "GET", sURL, False
        oHttp.send
        webpageSource = oHttp.ResponseText
    
        Set FSO = CreateObject("Scripting.FileSystemObject")
        Set oFile = FSO.CreateTextFile("webpageSource.txt")
        oFile.Write webpageSource
        oFile.Close
    
        Shell "cmd /C start webpageSource.txt"
    
    End Sub
    

    Does the file contain all content?

    0 讨论(0)
提交回复
热议问题