Class: cHttpTransfer

Properties  Events  Methods    Index of Classes

Implements HTTP client-side operations



Library: Common (Windows and Web Application) Class Library

Package: cHttpTransfer.pkg


The cHttpTransfer class implements HTTP client-side operations.

To communicate with an internet/intranet HTTP server, you must first create an object of this class, and then set the psRemoteHost property to the fully qualified domain name, or the IP address, of the HTTP server. If your network requires traffic to go through a proxy server, you should also set the psProxy property to the protocol for the proxy server, and the fully qualified domain name or IP address of that proxy server. Unless the remote HTTP server listens to port rpHttp (80 - the default), you also have to set the piRemotePort property to the specified port number.

User name and Password

If your Http site requires that you login, you may provide a username and password using the psUserName and psPassWord properties. Alternately, you can set the pbShowErrorDialog to True, which will cause a login dialog to popup when needed.

HTTPS - Secure SSL sites

This class can be used to access secure sites. A secure HTTPS site is usually accessed over a different port - rpHttpSSL (443), which you should set using piRemotePort. In addition, a secure site will require that you add the ifSecure to your transfer flags, which you set using peTransferFlags.

// properties to set to access an HTTPS site
Set piRemotePort to rpHttpSSL
Set peTransferFlags to ifSecure

In some cases, your secure site may require that you proivde a client certificate. The certificate may be selected using the SelectClientCertificate message. It may also be selected by the user by setting pbShowErrorDialog property to true. In both, cases a client certificate must be installed on your client computer.


This sample shows the equivalent to entering "" in the URL address line of a browser, with the exception that the URL will show its contents in a browser interpreted as HTML; instead the example saves the information to the MyOutPut.txt file.

Use Windows.pkg
Use cHtmlHelp.pkg
Use cApplication.pkg

Object oHtmlHelp is a cHtmlHelp

Object oApplication is a cApplication
    Set pbPreserveEnvironment to False
    Set peHelpType to htHtmlHelp

Use cHttpTransfer.pkg

Object oHttpTransfer is a cHttpTransfer
    Set psRemoteHost to ""
    Set pbShowErrorDialog to True

    Function DoDownloadFile String sFile Returns Integer
        Integer iRetVal

        Set psSaveAsFile to sFile
        Send ClearHeaders
        Get HttpGetRequest "Normal.asp?pageid=1403" to iRetVal

        Function_Return iRetVal

Procedure Test Global
    String sFile
    Integer iVal

    Move "c:\tmp\MyOutPut.txt" to sFile
    Get DoDownloadFile of oHttpTransfer sFile to ival

Send Test