I've been attempting to use HttpSendRequest in a VB6 application to perform an HTTP PUT to a Windows 2000 Server Web server (IIS 5.0). The code looks something like:
Public Declare Function HttpOpenRequest Lib "wininet.dll" Alias "HttpOpenRequestA" (ByVal hConnect As Long, ByVal sVerb As String, ByVal sObjectName As String, ByVal sVersion As String, ByVal sReferer As String, ByVal sAcceptTypes As String, ByVal lFlags As Long, ByVal lContext As Long) As Long
Public Declare Function HttpSendRequest Lib "wininet.dll" Alias "HttpSendRequestA" (ByVal hRequest As Long, ByVal sHeaders As String, ByVal lHeadersLength As Long, ByVal sOptional As String, ByVal lOptionalLength As Long) As Integer
..
..
..
hHTTPOpenRequestHandle = HttpOpenRequest(hInternetConnectHandle, "PUT", "/test.txt", sVersion, sReferrer, sAcceptTypes, lFlagsHttpOpenRequest, lContextHttpOpenRequest)
iHttpSendRequestEx = HttpSendRequest(hHTTPOpenRequestHandle, "", 0, "Test_string", Len("Test_string"))
When I run this code, HttpSendRequest returns TRUE as desired, indicating (I believe) that the request was sent to the Web server machine. But the file test.txt does not get written to the machine! What am I doing wrong? Please help or advise where I might find help.
Thank you.
Ron Sochanski
>> Stay informed about: HTTP PUT Method and IIS