Navigation:  thinBasic Modules > INet >

INET_Internet_OpenUrl

Previous pageReturn to chapter overviewNext page

 

Description

 

Opens a resource specified by a complete FTP or HTTP URL.

 

Syntax

 

hInternet = INET_Internet_OpenUrl(hInternet, sUrl , sHeader, dwFlags, dwContext)

 

Returns

 

Returns a valid handle to the URL if the connection is successfully established.

If function fails, it returns %NULL.

 

Parameters

 

Name

Type

Optional

Meaning

hInternet

Number

No

The handle to the current Internet session. The handle must have been returned by a previous call to INET_Internet_Open.

sUrl

String

No

String that specifies the URL to begin reading.

Only URLs beginning with ftp:, http:, or https: are supported.

sHeader

String

No

String that specifies the headers to be sent to the HTTP server

dwFlags

Number

No

Options. This parameter can be a combination multiple values. See INET Equates for the list of possible values.

dwContext

Number

No

A numeric value that specifies an application-defined value that is passed, along with the returned handle, to any callback functions.

 

Remarks

 

This is a general function that an application can use to retrieve data over any of the protocols that WinINet supports. This function is especially useful when the application does not need to access the particulars of a protocol, but only requires the data corresponding to a URL. The INET_Internet_OpenUrl function parses the URL string, establishes a connection to the server, and prepares to download the data identified by the URL. The application can then use INET_Internet_ReadFile  to retrieve the URL data.

 

After the calling application has finished using the hInternet handle returned by INET_Internet_OpenUrl, it must be closed using the INET_Internet_CloseHandle function.

 

When working in asynchronous mode (the dwFlags parameter of INET_Internet_Open specifies %INTERNET_FLAG_ASYNC), and the dwContext parameter is zero (%INTERNET_NO_CALLBACK), the callback function set with INET_Internet_SetStatusCallback on the session handle will not be invoked, however, the call will still be performed in asynchronous mode.

 

Restrictions

 

See also

 

Examples