open Method (ServerXMLHTTP/IServerXMLHTTPRequest)
Initializes a request and specifies the method, URL, and authentication information for the request.
[Script]
Script Syntax
oServerXMLHTTPRequest.open(bstrMethod, bstrUrl, bAsync, bstrUser,
bstrPassword);
Parameters
- bstrMethod
- The HTTP method used to open the connection, such as PUT or PROPFIND.
- bstrUrl
- The requested URL. This can be either an absolute URL, such as "http://Myserver/Mypath/Myfile.asp", or a relative URL, such as "../MyPath/MyFile.asp".
- bAsync (optional)
- Boolean. Indicator as to whether the call is asynchronous. The default is False (the call does not return immediately).
- bstrUser (optional)
- The name of the user for authentication.
- bstrPassword (optional)
- The password for authentication. This parameter is ignored if the user parameter is Null or missing.
Example
<%@language=JScript%>
<%
var srvXmlHttp
srvXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.5.0");
srvXmlHttp.open ("GET", "http://myserver/myresponse.asp", false);
srvXmlHttp.send();
newsElement = srvXmlHttp.responseXML.selectSingleNode("/news/story1");
%>
<html>
<body>
<p>Top News Story<p>
<%Response.write(newsElement.text);%>
</body>
</html>
[Visual Basic]
Visual Basic Syntax
oServerXMLHTTPRequest.open(bstrMethod, bstrUrl, bAsync, bstrUser,
bstrPassword)
Parameters
- bstrMethod
- The HTTP method used to open the connection, such as PUT or PROPFIND.
- bstrUrl
- The requested URL. This can be either an absolute URL, such as "http://Myserver/Mypath/Myfile.asp", or a relative URL, such as "../MyPath/MyFile.asp".
- bAsync (optional)
- Boolean. Indicator as to whether the call is asynchronous. The default is False (the call does not return immediately).
- bstrUser (optional)
- The name of the user for authentication. If this parameter is Null ("") or missing and the site requires authentication, the component displays a logon window.
- bstrPassword (optional)
- The password for authentication. This parameter is ignored if the user parameter is Null or missing.
[C/C++]
C/C++ Syntax
HRESULT open(BSTR bstrMethod, BSTR bstrUrl, VARIANT bAsync,
VARIANT bstrUser, VARIANT bstrPassword);
Parameters
- bstrMethod [in]
- The HTTP method used to open the connection, such as PUT or PROPFIND.
- bstrUrl [in]
- The requested URL. This can be either an absolute URL, such as "http://Myserver/Mypath/Myfile.asp", or a relative URL, such as "../MyPath/MyFile.asp".
- bAsync [in, optional]
- Boolean. Indicator as to whether the call is asynchronous. The default is False (the call does not return immediately).
- bstrUser [in, optional]
- The name of the user for authentication. If this parameter is Null ("") or missing and the site requires authentication, the component displays a logon window.
- bstrPassword [in, optional]
- The password for authentication. This parameter is ignored if the user parameter is Null or missing.
C/C++ Return Values
- S_OK
- The value returned if successful.
Remarks
After calling this method you must call the send
method to send the request and data (if any) to the server. Each send
method must have a corresponding open
method.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
See Also
abort Method
Applies to: IServerXMLHTTPRequest/ServerXMLHTTP