为实现Http访问,微软提供了二套API:WinINet, WinHTTP。
WinHTTP比WinINet更加安全和健壮,可以这么认为WinHTTP是WinINet的升级版本。
下面是WinHTTP常规接口调用步骤:
WintpOpen
WinHttpConnect
WinHttpOpenRequest
WinHttpAddRequestHeaders
WinHttpSendRequest
WinHttpReceiveResponse
WinHttpQueryHeaders
WinHttpReadData
WinHttpCloseHandle
int contextLengthId = WINHTTP_QUERY_CONTENT_LENGTH;
int statusCodeId = WINHTTP_QUERY_STATUS_CODE;