Re: VB6 WinHttp not working
This isn't the correct part of the forum for posting questions. It is used for posting sample code/projects that can be used as-is.
I've notified the moderators so that they can move this to the proper forum section for you
Re: VB6 WinHttp not working
Quote:
Originally Posted by
XardozCom
Code:
Dim HTTP
Set HTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
HTTP.setTimeouts 50000, 50000, 50000, 50000
HTTP.Open "POST", sAddress, True
HTTP.setRequestHeader "Content-Type", "multipart/form-data; boundary=" & ""
'On Local Error Resume Next
HTTP.send Data
resp = HTTP.responseText
We have an old VB6 Project that we are updating.
After a client asked for changes, the above code stopped working
On the HTTP.send, we get "
the data necessary to complete this operation is not yet available"
Been searching Google but can not find a good solution.
The first mistake I see, is that you are using the HTTP-Object in async-mode (last Param in the Open-method).
So don't expect to get anything useful returned in your last line:
resp = HTTP.responseText
shortly after sending the request (asynchronously).
Though since you apparently get the error already when you call the Send-method,
I'd suspect that what you've passed in your Data-Variable was not valid multipart/form-data
content - or (more likely) 'Data' even being "completely emtpy yet".
Olaf
Re: VB6 WinHttp not working
Sorry for the mis-post.
Thank you Olaf, I found the solution as you posted :)
Issue solved.
Below causes the issue, ASYNC=True
Code:
HTTP.Open "POST", sAddress, True
This works! ASYNC=False
Code:
HTTP.Open "POST", sAddress, False