I am trying to send HTTP post through VBA. Here is my part of code
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
The problem is, the code is working only if the postString
is less than 65535
characters. If it exceeds 65535
characters, it throws error on below line:
ERROR: Incorrect parameter
objHTTP.setRequestHeader "content", postString
Any ideas about this? Do I need to set any other parameter to make it work around?
Per: https://support.microsoft.com/en-us/kb/290591
This should work:
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
If it does not work, then maybe there's something going on with your server-side setup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With