Does anyone here know a way to get the answer header from a HTTP request via Clarion?
We found a .clw that trys to use the WinHTTP lib from Windows to the the work. The Post method is working fine, but I still cannot get the headers the que server is anwering to me to register in my system.
Thats the method that we are using:
WebClientClass.GetHeader procedure(string HeaderProcurado)
BufferLength ULONG
HeaderBufferAddress LONG
ansiaddress LONG
ansistring &cstring
CODE
!determine headers
ansistring &= NULL
if wc_WinHttpQueryHeaders(SELF.hRequest, WINHTTP_QUERY_CUSTOM,HeaderProcurado, WINHTTP_NO_OUTPUT_BUFFER, Address(BufferLength), WINHTTP_NO_HEADER_INDEX) = 0
HeaderBufferAddress = SELF.CreateSafeWideReference(BufferLength)
end!if
if SELF.InValidState()
if wc_WinHttpQueryHeaders(SELF.hRequest,WINHTTP_QUERY_CUSTOM,HeaderProcurado, HeaderBufferAddress, ADDRESS(BufferLength), WINHTTP_NO_HEADER_INDEX) = 0
SELF.ThrowError(Err:QueryHeadersFailed,'Query header failed. '& GetLastError())
ELSE
ansiaddress = SELF.FromWideString(HeaderBufferAddress)
ansistring &= SELF.ReferenceToString(ansiaddress)
end!if
end!if
message('Header: ' & ansistring)
return ansistring