Creates an HTTP request handle.
Syntax
HINTERNET HttpOpenRequest( IN HINTERNET hConnect, IN LPCTSTR lpszVerb, IN LPCTSTR lpszObjectName, IN LPCTSTR lpszVersion, IN LPCTSTR lpszReferer, IN LPCTSTR FAR * lpszAcceptTypes, IN DWORD dwFlags, IN DWORD_PTR dwContext );The actual syntax of this function varies between its ANSI and Unicode implementations. For more information, see Win32 Internet Functions Syntax.
Parameters
- hConnect
- HINTERNET handle to an HTTP session returned by InternetConnect.
- lpszVerb
- Address of a string that contains the verb to use in the request. If this parameter is NULL, the function uses GET as the verb.
- lpszObjectName
- Address of a string that contains the name of the target object of the specified verb. This is generally a file name, an executable module, or a search specifier.
- lpszVersion
- Address of a string that contains the HTTP version. If this parameter is NULL, the function uses HTTP/1.0 as the version.
- lpszReferer
- Address of a string that specifies the address (URL) of the document from which the URL in the request (lpszObjectName) was obtained. If this parameter is NULL, no "referrer" is specified.
- lpszAcceptTypes
- Address of a null-terminated array of string pointers indicating media types accepted by the client. If this parameter is NULL, no types are accepted by the client. Servers interpret a lack of accept types to indicate that the client accepts only documents of type "text/*" (that is, only text documents, and not pictures or other binary files). For a listing of valid media types, see Media Types at ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types .
- dwFlags
- Unsigned long integer value that contains the Internet flag values. This can be any of the following values:
- INTERNET_FLAG_CACHE_IF_NET_FAIL
- INTERNET_FLAG_HYPERLINK
- INTERNET_FLAG_IGNORE_CERT_CN_INVALID
- INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
- INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
- INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
- INTERNET_FLAG_KEEP_CONNECTION
- INTERNET_FLAG_NEED_FILE
- INTERNET_FLAG_NO_AUTH
- INTERNET_FLAG_NO_AUTO_REDIRECT
- INTERNET_FLAG_NO_CACHE_WRITE
- INTERNET_FLAG_NO_COOKIES
- INTERNET_FLAG_NO_UI
- INTERNET_FLAG_PRAGMA_NOCACHE
- INTERNET_FLAG_RELOAD
- INTERNET_FLAG_RESYNCHRONIZE
- INTERNET_FLAG_SECURE
- dwContext
- Address of an unsigned long integer value that contains the application-defined value that associates this operation with any application data.
Return Value
Returns a valid (non-NULL) HTTP request handle if successful, or NULL otherwise. To get extended error information, call GetLastError.
Remarks
HttpOpenRequest creates a new HTTP request handle and stores the specified parameters in that handle. An HTTP request handle holds a request to be sent to an HTTP server and contains all RFC822/MIME/HTTP headers to be sent as part of the request.
Beginning with Microsoft® Internet Explorer 5, if lpszVerb is set to "HEAD", the Content-Length header is ignored on responses from HTTP/1.1 servers.
Function Information
Windows NT Use version 4.0. Implemented as ANSI and Unicode functions. Windows Use Windows 95 and later. Implemented as ANSI and Unicode functions. Header Wininet.h Import library Wininet.lib Minimum availability Internet Explorer 3.0 (ANSI only), 5 (ANSI and Unicode)
Windows CE
Windows CE Use version 2.12 and later. Implemented as ANSI and Unicode functions. Minimum availability Internet Explorer 4.0
See Also
Microsoft Win32 Internet Functions Overview, HTTP Sessions, Microsoft Win32 Internet Functions Reference, HTTP Functions