vbs xmlhttp 响应文本被截断?

发布于 2025-01-08 18:52:30 字数 1089 浏览 3 评论 0原文

大家好,我有一个简单的 vbs 脚本,它正在抓取一个 url(使用 GET 获取值),我需要解析文本。然而,我收到的响应文本并不是完整的响应。我收到一个长度为 1000 的字符串,但我知道响应应该更像 5000。

Function getServer(server_hostname)
    Set objHTTP = CreateObject("msxml2.xmlhttp.3.0")
    objHTTP.open "GET", "http://someurl/ServerInfo.asp", False
    objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    objHTTP.send "B1=GO!!&Server=" + server_hostname 

    getServer = objHTTP.responseText
End Function

serverStr = getServer(server_hostname)
msgbox(Len(serverStr))

可以返回的数量是否有限制?感谢您的帮助。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

所以我将我的功能更改为:

Function getServer(server_hostname)
    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
    objHTTP.open "GET", "http://someurl/ServerInfo.asp?B1=GO!!&Server=" + server_hostname , False
    'objHTTP.setRequestHeader "Content-Type", "text/html"
    'objHTTP.send "B1=GO!!&Server=" + server_hostname 
    objHTTP.send

    getServer = objHTTP.responseText
End Function

现在它可以工作了......不知道为什么。

Hello all i have a simple vbs script that is grabbing a url(with values using GET) and I need to parse thru the text. However the responsetext i am getting is not the full response. i am getting a string that is 1000 in length however i know the response should be more like 5000.

Function getServer(server_hostname)
    Set objHTTP = CreateObject("msxml2.xmlhttp.3.0")
    objHTTP.open "GET", "http://someurl/ServerInfo.asp", False
    objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    objHTTP.send "B1=GO!!&Server=" + server_hostname 

    getServer = objHTTP.responseText
End Function

serverStr = getServer(server_hostname)
msgbox(Len(serverStr))

Is there a limitation on how much can be returned? Thank you for your help.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

So i change my function to:

Function getServer(server_hostname)
    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
    objHTTP.open "GET", "http://someurl/ServerInfo.asp?B1=GO!!&Server=" + server_hostname , False
    'objHTTP.setRequestHeader "Content-Type", "text/html"
    'objHTTP.send "B1=GO!!&Server=" + server_hostname 
    objHTTP.send

    getServer = objHTTP.responseText
End Function

And now it works...no idea why.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水水月牙 2025-01-15 18:52:30

MsgBox 的最大长度为 1024 个字符。

参考:http://www.w3schools.com/vbscript/func_msgbox.asp

The maximum MsgBox length is 1024 characters.

Ref: http://www.w3schools.com/vbscript/func_msgbox.asp

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文