Sample code for 30+ languages & platforms
DataFlex

Send HTTPS Get Without Waiting for the Response

See more REST Examples

This example demonstrates sending an HTTP GET request without waiting for the response.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoRest
    Boolean iBAutoReconnect
    Integer iMaxWaitMs
    String sTemp1

    Move False To iSuccess

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatRest)) To hoRest
    If (Not(IsComObjectCreated(hoRest))) Begin
        Send CreateComObject of hoRest
    End

    // Connect to the server using TLS
    Move False To iBAutoReconnect
    Get ComConnect Of hoRest "example.com" 443 True iBAutoReconnect To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Send a GET request to https://example.com/some/path 
    Get ComSendReqNoBody Of hoRest "GET" "/some/path" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // OK, the request was sent.
    // Close the connection.
    Move 50 To iMaxWaitMs
    Get ComDisconnect Of hoRest iMaxWaitMs To iSuccess

    Showln "GET Request Sent."


End_Procedure