To get a WININET session started, you call InternetOpen:

  function InternetOpen(lpszCallerName  : PChar;              // Normal: Name of the program
                        dwAccessType    : DWORD; 
                        lpszServerName  : PChar;           
					    nServerPort     : INTERNET_PORT; 
                        dwFlags: DWORD) : HINTERNET; stdcall;
						
	dwAccessType: // access types for InternetOpen from WinInet.pas, Zeile 438ff
	const
	  INTERNET_OPEN_TYPE_PRECONFIG                    = 0;  // use registry configuration 
	  INTERNET_OPEN_TYPE_DIRECT                       = 1;  // direct to net 
	  INTERNET_OPEN_TYPE_PROXY                        = 3;  // via named proxy 
      INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  = 4;  // prevent using java/script/INS 

  Example:

  var
    hSession : HInternet;

  hSession := InternetOpen('InternetReader',
                            INTERNET_OPEN_TYPE_PRECONFIG, 
						    nil, 
						    nil, 
						    0);
		
		
Connect to server using InternetConnect:

  function InternetConnect(hInet: HINTERNET;           // Handle from InternetOpen
                           lpszServerName: PChar;      // Server: i.e., www.borland.com
                           nServerPort: INTERNET_PORT; // Usually 0
                           lpszUsername: PChar;        // usually anonymous
                           lpszPassword: PChar;        // usually your email address
                           dwService: DWORD;           // FTP, HTTP, or Gopher?
                           dwFlags: DWORD;             // Usually 0
                           dwContext: DWORD):          // User defined number for callback
                           HINTERNET; stdcall;
						   
	nServerPort: // default HTTP Port from WinInet.pas, Zeile 44
	const				   
      INTERNET_DEFAULT_HTTP_PORT = 80;
	  
    dwService:   // default HTTP Port from WinInet.pas, Zeile 471
    const 
      INTERNET_SERVICE_HTTP = 3;
						   
  Example:
  
  var
    hConnect : HInternet;
	sServer  : string;
	
  hConnect := InternetConnect(hSession,                   
                              PChar(sServer),              
                              INTERNET_DEFAULT_HTTP_PORT, 
							  nil,                        
							  nil,                        
							  INTERNET_SERVICE_HTTP,     
							  0,                          
							  0);                        


The HttpOpenRequest() function sends the request parameters to the Internet service 
and returns a request handle.

  function HttpOpenRequest(hConnect: HINTERNET;      // Handle from InternetConnect
                           lpszVerb: PChar;          // Usually: 'GET'
                           lpszObjectName: PChar;    // Filename
						   lpszVersion: PChar;       // HTTP Version to use nil = 'HTTP/1.0'
						   lpszReferrer: PChar;      // Refer Document, nil = no refer
                           lplpszAcceptTypes: PChar; // Usually: nil
						   dwFlags: DWORD;           // Usually: INTERNET_FLAG_RELOAD
                           dwContext: DWORD):        // Usually: 0
						   HINTERNET; stdcall;       
						   
  dwFlags:
  const				   
    INTERNET_FLAG_RELOAD = $80000000;           //  retrieve the original item, Zeile 83  
						   
  Example:
  
  var
    hRequest : HInternet;
	sFile    : string;

  hRequest := HttpOpenRequest(hConnect, 
                              'GET', 
							  PChar(sFile), 
							  'HTTP/1.0', 
							  nil,
                              nil, 
							  INTERNET_FLAG_RELOAD, 
							  0);


The HttpSendRequest() function sends the request parameters to the Internet service 
and returns a request handle.

  function HttpSendRequest(hRequest: HINTERNET;      // Handle from HttpOpenRequest
                           lpszHeaders: PChar;       // additional headers, nil = no headers
                           dwHeadersLength: DWORD;   // length in characters of lpszHeaders, 0 = no headers
						   lpOptional: Pointer;      // optional data to send immediately after the request, nil = no data
                           dwOptionalLength: DWORD): // length in characters of lpOptional, 0 = optional data
						   BOOL; stdcall;
	
	
  Example:
  
  HttpSendRequest(hRequest, 
                  nil, 
				  0, 
				  nil, 
				  0);
	

To get the size, in bytes, of the file you want to read, call the HttpQueryInfo() function 
(with a HTTP_QUERY_CONTENT_LENGTH flag to specify that you're looking for the file size).

  function HttpQueryInfo(hRequest: HINTERNET;         // Handle from HttpOpenRequest
                         dwInfoLevel: DWORD;          // Usually: HTTP_QUERY_CONTENT_LENGTH
                         lpvBuffer: Pointer;          // Address of the buffer that receives the information.
						 var lpdwBufferLength: DWORD; // Length of the data buffer.
                         var lpdwReserved: DWORD):    // Usually: 0
						 BOOL; stdcall;
  
  
  Example:
  
  var
    dwIndex  : DWORD;
    dwBufLen : DWORD;
    lpBuf    : Pointer;
	dwBufLen : DWORD;
	FTRslt   : Boolean;
	
  dwIndex := 0;
  dwBufLen := 1024;
  GetMem(lpBuf, dwBufLen);
  
  FTRslt := HttpQueryInfo(hRequest, 
                          HTTP_QUERY_CONTENT_LENGTH,   // Size of the file requested
						  lpBuf, 
						  dwBufLen,
    					  dwIndex);
						  
						  
						  
To actually read the file, now that you've made it this far, 
you must call the InternetReadFile() function

  function InternetReadFile(hFile: HINTERNET;                  // Handle from HttpOpenRequest
                            lpBuffer: Pointer;                 // Address of a buffer that receives the data
                            dwNumberOfBytesToRead: DWORD;      // Number of bytes to read from the file
							var lpdwNumberOfBytesRead: DWORD): // Address of a variable that receives the actual number of bytes read
							BOOL; stdcall;

  Example:
  
  var
    lpData : array [0..1024] of Char;

  InternetReadFile(hRequest, 
                   @lpData, 
				   SizeOf(lpData),
                   dwBtRead);


Close a Internet Handle:

function InternetCloseHandle(hInet: HINTERNET): BOOL; stdcall;

  Example:
  
  InternetCloseHandle(hRequest);
  InternetCloseHandle(hConnect);
  InternetCloseHandle(hSession);