替代MSXML2为VBA获取大的HTTP请求,以获得readyState的3? [英] Alternative to MSXML2 for VBA retrieving large HTTP requests, with access to readyState 3?

查看:234
本文介绍了替代MSXML2为VBA获取大的HTTP请求,以获得readyState的3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:这个问题已经改变,因为我已经等了一个答案,并完成外部研究。我已经改写了冠军,而真正的问题是,我正在寻找一个替代MSXML2(即使这意味着写作插座code)。 问题的原身是离开这里,以供参考和帮助人们在未来谁在做类似的搜索。

This question has changed as I have waited for an answer and done external research. I've rephrased the title, and the question is really that I'm looking for an alternative to MSXML2 (even if it means writing socket code). The original body of the question is left here for reference and to help people in the future who are doing similar searches.

在VBA,使用MSXML2对象,有没有一种方式来获得访问   流媒体数据,同时readyState的= 3,因为它有?

In VBA, using MSXML2 object, is there a way to get access to the streaming data while readyState = 3, as it comes in?

我现在用的是的onreadystatechange 的方法,但我似乎不有   访问的responseText ,直到readyState为4。当readyState为3,   似乎没有被任何数据。

I am using the OnReadyStateChange method, but I don't seem to have access to responseText until readyState is 4. When readyState is 3, there doesn't seem to be any data.

有没有办法在VBA有访问HTTP流响应   同时它来了呢?另一种方法,我可以在MSXML2使用,或   更好的(免费,可分配)对象,以便使AJAX电话?

Is there any way in VBA to have access to the HTTP streaming response while it is coming in? Another method I could use in MSXML2, or a better (free, distributable) object to use to make "AJAX" calls?

更多信息:如果我尝试读取 responseStream (或   的responseText ),该错误说明是:

More information: If I try to read responseStream (or responseText), the error description is:

要完成此操作的数据尚未公布。

第二个编辑,了解更多信息:此链接基本上说,这是   在互动预期的行为(3)状态:
  的http://msdn.microsoft.com/en-us/library/windows/desktop/ms753800(v=vs.85).aspx

Second edit, more information: This link basically says that this is expected behavior in the INTERACTIVE (3) state:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms753800(v=vs.85).aspx

所以,我肯定要找的没有任何的选择吗?的回答。

推荐答案

这是code旧一点我写信给读取使用WinInet API块,它不是异步的,但它暴露了一个读取缓冲区每512字节后(我添加了一个Debug.Print读和放大器; lngTotalBytesRead说明) - http://pastebin.com/6uMhkBUF

This is an old bit of code I wrote to reads chunks using the WinInet API, its not asynchronous but it exposes a read buffer after every 512 bytes (I added a Debug.Print "READ " & lngTotalBytesRead to illustrate) - http://pastebin.com/6uMhkBUF

从我还记得它的工作确定,但我不得不取消裂伤它一下。

From what I can remember it worked ok but I've had to un-mangle it a bit.

  • 您将需要删除的通话应用在 HTTPGetUAString 。(这是VB6原)所以刚 HTTPGetUAString =MyThing等。

如果(lngContentLen = 0&安培;)然后lngContentLen =(BUFF_LEN * DUMMY_BUFF_MULTIPLIER)是一个遗留的;你可以删除行。 (随后如果lngContentLen为零的大小是事先未知)

If (lngContentLen = 0&) Then lngContentLen = (BUFF_LEN * DUMMY_BUFF_MULTIPLIER) is a left-over; you can delete the line. (Subsequently if lngContentLen is zero the size is unknown in advance)

这篇关于替代MSXML2为VBA获取大的HTTP请求,以获得readyState的3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆