问题
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