Lin*_*vel 12 vba ms-word word-vba
我正在尝试通过VBA发送HTTP帖子.这是我的代码部分
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.Open "POST", url, False
objHTTP.setRequestHeader "User-Agent", "EPS 1.0"
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.setRequestHeader "content", postString
objHTTP.setRequestHeader "Content-Length", Len(postString)
objHTTP.send
Run Code Online (Sandbox Code Playgroud)
问题是,代码仅在postString
小于65535
字符时才起作用.如果超过65535
字符,则会在下面的行中抛出错误:
错误:参数不正确
objHTTP.setRequestHeader "content", postString
Run Code Online (Sandbox Code Playgroud)
有关于此的任何想法?我是否需要设置任何其他参数才能使其解决?
根据: https: //support.microsoft.com/en-us/kb/290591
这应该有效:
postString = "id=" & String(66000,"x")
Dim xmlhttp
Set xmlhttp = Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send postString
Run Code Online (Sandbox Code Playgroud)
如果它不起作用,则可能是您的服务器端设置出现问题。