【发布时间】:2016-11-04 03:17:05
【问题描述】:
我想从网站获取 HTML 文档结构,以便从中提取信息。我使用 GET 请求,但它返回 416 状态。在其他网站上,这种简单的 GET 请求足以得到响应。
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
【问题讨论】:
-
修复 416 错误和抓取页面是完全不同的事情。您可能应该提出一个新问题,以便标题和标签有意义。
标签: vba xmlhttprequest