VBA - MSXML2.ServerXMLHTTP GET Request - Server status 416

穿精又带淫゛_ 提交于 2021-01-29 02:55:30

问题


I want to get HTML document structure from a website so I can extract information from it. I use GET request, but it returns 416 status. On other websites such plain GET request was enough to get a response.

Dim oXMLHTTP As New MSXML2.ServerXMLHTTP
Dim htmlObj As New HTMLDocument

With oXMLHTTP
    .Open "GET", "http://www.manta.com/ic/mtqyfk0/ca/riverbend-holdings-inc", False
    .send

    If .ReadyState = 4 And .Status = 200 Then
        Set htmlObj = CreateObject("htmlFile")
        htmlObj.body.innerHTML = .responseText
        'do things
    End If

End With

回答1:


You should be able to just use XMLHTTP instead of ServerXMLHTTP

  Dim oXMLHTTP As New MSXML2.XMLHTTP60

Returns 200 for me.



来源:https://stackoverflow.com/questions/40397810/vba-msxml2-serverxmlhttp-get-request-server-status-416

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!