CWinHttpRequest.Openmethod
Opens an HTTP connection to an HTTP resource.
Syntax
FUNCTION Open (BYREF wszMethod AS WSTRING, BYREF dwsUrl AS WSTRING, BYVAL bAsync AS BOOLEAN = FALSE) AS HRESULT
Parameters
| Name | Description | |
|---|---|---|
wszMethod | A unicode strring that specifies the HTTP verb used for the Open method, such as "GET" or "PUT". Always use uppercase as some servers ignore lowercase HTTP verbs. | |
wszUrl | A unicode string that contains the name of the resource. This must be an absolute URL. | |
bAsync | Optional. A value of type Boolean that specifies whether to open in asynchronous mode. TRUE: Opens the HTTP connection in asynchronous mode. FALSE: Opens the HTTP connection in synchronous mode. A call to Send does not return until WinHTTP has completely received the response. |
Return value
The return value is S_OK (0) on success or an error value otherwise.
Description
Opens an HTTP connection to an HTTP resource.
Remarks
This method opens a connection to the resource identified in cbsUrl using the HTTP verb given in cbsMethod.
Example
#include once "AfxNova/CWinHttpRequest.inc" USING AfxNova
' // Create an instance of the CWinHttpRequest class DIM pWHttp AS CWinHttpRequest ' // Open an HTTP connection to an HTTP resource pWHttp.Open "GET", "http://microsoft.com" ' // Send an HTTP request to the HTTP server pWHttp.Send ' // Wait for response with a timeout of 5 seconds DIM iSucceeded AS LONG = pWHttp.WaitForResponse(5)
Reference
- Defined in AfxNova/CWinHttpRequest.inc:180
- Documented in COM/CWinHttpRequest Class.md
- Topic: CWinHttpRequest Class