在 VB6 中检索热链接的 WinHttpReq.ResponseBody 跳过页面数据的最佳方法

Best way to retreive WinHttpReq.ResponseBody skipped page data that is hot-linked, in VB6

我正在尝试维护一个 Visual Basic 6 软件,该软件旨在帮助加快我工作部门的某些文本格式设置。我不太会计算机engineer/scientist,但是这个软件属于我的管辖范围,因为它是由我受雇取代的那位先生编写的。

此工具用于在短时间内格式化大量数据,以消除手动格式化。

似乎是传递给程序用户指定的 URL 的 WinHttpRequest 大部分工作正常。然而,当 ResponseBody 属性 被调用时,所编写的软件所期望的信息并没有被抓取。我不确定数据之前是如何托管在 URL 页面上的,但是当通过网络浏览器检查相关 URL 的页面源时,预期检索的数据是可见,但似乎是从另一个 URL/location 热链接进来的。但是当创建 WinHttpReq.ResponseBody 并将其转储到本地文件中时,预期和需要的信息将被传递。

它看起来像是在传递数据,因为数据是通过原始 URL 中的单独热链接引用的。我的问题是,检索在检查页面源时可见但未在 ResponseBody 函数调用中检索到的数据的最简单方法是什么。 ResponseBody 调用似乎也将热链接 URL 丢弃到初始 HTTP 请求 URL 中,但我认为用于构建热链接的信息和 ID 存储在数据中。

' Create an array to hold the response data.
Dim d() As Byte

' Assemble an HTTP request.
WinHttpReq.Open "GET", ap_feedreq, False

' Set the user name and password.
WinHttpReq.SetCredentials ap_user, ap_pass, _
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER

' Send the HTTP Request.
WinHttpReq.Send

' Display the response headers.
' MsgBox WinHttpReq.GetAllResponseHeaders & "  " & WinHttpReq.ResponseText

If WinHttpReq.status = 200 Then

    webwire1.StatusBar1.Panels(1).Text = "Authentication Complete ..... 
    Parsing XML File"
    webwire1.StatusBar1.Refresh

    docpath1$ = mydocpath + "aptemp.txt"
    Open docpath1$ For Binary As #1
    d() = WinHttpReq.ResponseBody
    Put #1, 1, d()
    Close #1

这是一张图片,展示了我所看到的内容,希望能更好地展示我所指的内容。

Feed Body Comparison Browser vs. Local Data

软件中编写的解析函数查找 "nitf version =" 标志,以了解何时找到用于格式化的统计 data/tables。

我的问题是,是否有一种更简单、更优雅的解决方案可以一次性提取所有网页源数据,使其在 Web 浏览器中可见?或者我是否必须拉取响应主体,解析主体文本,使用变量构建 URL,传递更多单独的页面 URL 请求,存储该文本,解析该数据,然后加载将数据解析回原始主体数据?

我想尽量少改动写好的软件。

最好的办法是查看 VB6 中 Fiddler and see what differs at the lowest level. For someone to help you on SO, they will likely need to view the raw HTTP response. From what I can tell, this is not (directly) related to VB6 nor WinHttpRequest but I'm not sure how the browser is deciding to fetch the data -- it may be via JavaScript or something XML/HTTP/feed specific. It could even be that you need to send an Accept header to get different content from the AP server. Or, like you said, you may have to manually pull each URL. If you need to act exactly as a browser would, you could use NWJS, Electron, CEF, PhantomJS (or now headless Chromium), etc. Or there is a WebBrowser 控件的输出。