Open Method (IXMLHTTPRequest2, Windows 8)
Initializes an IXMLHTTPRequest2 request and specifies the method, URL, and authentication information for the request.
HRESULT Open(const WCHAR *pwszMethod, const WCHAR *pwszUrl, IXMLHTTPRequest2Callback *pStatusCallback, const WCHAR *pwszUserName, const WCHAR *pwszPassword, const WCHAR *pwszProxyUserName, const WCHAR *pwszProxyPassword );
Parameters
pwszMethod[in, string, ref]
The HTTP method used to open the connection, such as GET or POST.
pwszUrl[in, string, ref]
The requested URL. This can be either an absolute URL, such as "http://Myserver/Mypath/Myfile.asp".
pStatusCallback[in]
A callback function that is called when a callback event occurs.
pwszUserName[in, string, unique]
The name of the user for authentication. If this parameter is Null and the site requires authentication, the component displays a logon window unless the SetProperty method has been called to disable user input prompts, authentication, or both.
pwszPassword[in, string, unique]
The password for authentication. This parameter is ignored if the pwszUserName parameter is Null or missing.
pwszProxyUserName[in, string, unique]
The name of the user for authentication to the proxy server. If this parameter is Null and the proxy server requires authentication, the component displays a logon window unless the SetProperty method has been called to disable user input prompts, authentication, or both.
pwszProxyPassword[in, string, unique]
The password for authentication to the proxy server. This parameter is ignored if the pwszProxyUserName parameter is Null or missing.
Return Values
S_OK
The value returned if successful.
Example
HRESULT hr; IXMLHttpRequest *pIXMLHttpRequest = NULL; try { // Create XMLHttpRequest object and initialize pIXMLHttpRequest. hr = pIXMLHttpRequest->open(_bstr_t(_T("PUT")), _bstr_t(_T("GET","http://MyServer/Sample.xml", false)), _variant_t(VARIANT_FALSE), _variant_t(""), _variant_t("")); if(SUCCEEDED(hr)) ::MessageBox(NULL, _T("Success !"), _T(""), MB_OK); } catch(...) { DisplayErrorToUser(); } // Release pIXMLHttpRequest when finished with it.
After calling this method, you must call Send to send the request and data, if any, to the server.
Although this method accepts credentials passed via parameter, those credentials are not automatically sent to the server on the first request. The |
Implemented in: MSXML 6.0
Abort Method (IXMLHTTPRequest2, Windows 8)
Send Method (IXMLHTTPRequest2, Windows 8)
SetProperty Method (Windows 8, C++)
IXMLHTTPRequest2 (Windows 8)