CStdioFile* OpenURL( LPCTSTR pstrURL, DWORD dwContext = 1, DWORD dwFlags = INTERNET_FLAG_TRANSFER_ASCII, LPCTSTR pstrHeaders = NULL, DWORD dwHeadersLength = 0 );
Throw ( CInternetException );
Return Value
Returns a file handle for FTP, GOPHER, HTTP, and FILE-type Internet services only. Returns NULL if parsing was unsuccessful.
The pointer that OpenURL returns depends on pszURL’s type of service. The table below illustrates the possible pointers OpenURL can return.
URL type | Returns |
file:// | CStdioFile* |
http:// | CHttpFile* |
gopher:// | CGopherFile* |
ftp:// | CInternetFile* |
Parameters
pstrURL
A pointer to the name of the URL to begin reading. Only URLs beginning with file:, ftp:, gopher:, or http: are supported. ASSERTS if pszURL is NULL.
dwContext
An application-defined value passed with the returned handle in callback.
dwFlags
The flags describing how to handle this connection. See Remarks for more information about the valid flags. The valid flags are:
pstrHeaders
A pointer to a string containing the headers to be sent to the HTTP server.
dwHeadersLength
The length, in characters, of the additional headers. If this is -1L and pstrHeaders is non-NULL, then pstrHeaders is assumed to be zero terminated and the length is calculated.
Remarks
Call this member function to send the specified request to the HTTP server and allow the client to specify additional RFC822, MIME, or HTTP headers to send along with the request.
The parameter dwFlags must include either INTERNET_FLAG_TRANSFER_ASCII or INTERNET_FLAG_TRANSFER_BINARY, but not both. The remaining flags can be combined with the bitwise OR operator (|).
OpenURL, which wraps the Win32 function InternetOpenURL, allows only downloading, retrieving, and reading the data from an Internet server. OpenURL allows no file manipulation on a remote location, so it requires no CInternetConnection object.
To use connection-specific (that is, protocol-specific) functions, such as writing to a file, you must open a session, then open a particular kind of connection, then use that connection to open a file in the desired mode. See CInternetConnection for more information about connection-specific functions.
CInternetSession Overview | Class Members | Hierarchy Chart
See Also CInternetConnection, CGopherConnection, CInternetSession::GetFtpConnection, CInternetSession::GetHttpConnection