共用方式為


CHttpFile::SendRequest

Call this member function to send a request to an HTTP server.

BOOL SendRequest(
   LPCTSTR pstrHeaders = NULL,
   DWORD dwHeadersLen = 0,
   LPVOID lpOptional = NULL,
   DWORD dwOptionalLen = 0 
);
BOOL SendRequest(
   CString& strHeaders,
   LPVOID lpOptional = NULL,
   DWORD dwOptionalLen = 0 
);

Parameters

  • pstrHeaders
    A pointer to a string containing the name of the headers to send.

  • dwHeadersLen
    The length of the headers identified by pstrHeaders.

  • lpOptional
    Any optional data to send immediately after the request headers. This is generally used for POST and PUT operations. This can be NULL if there is no optional data to send.

  • dwOptionalLen
    The length of lpOptional.

  • strHeaders
    A string containing the name of the headers for the request being sent.

Return Value

Nonzero if successful; otherwise 0. If the call fails, determine the cause of the failure by examining the thrown CInternetException object.

Exceptions

This method can throw exceptions of type CInternetException.

Requirements

Header: afxinet.h

See Also

Concepts

CHttpFile Class

CHttpFile Members

Hierarchy Chart

CInternetFile Class

CHttpFile::SendRequestEx