Sample code for 30+ languages & platforms
DataFlex

Transition from Http.GetHead to Http.HttpNoBody

Provides instructions for replacing deprecated GetHead method calls with HttpNoBody.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoHttp
    String sUrl
    Variant vResp1
    Handle hoResp1
    Variant vResp2
    Handle hoResp2
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End
    Move "https://www.example.com/" To sUrl

    // ------------------------------------------------------------------------
    // The GetHead method is deprecated:

    Get ComGetHead Of hoHttp sUrl To vResp1
    If (IsComObject(vResp1)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp1
        Set pvComObject Of hoResp1 To vResp1
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp1 To iTemp1
    Showln iTemp1
    Send Destroy of hoResp1

    // ------------------------------------------------------------------------
    // Do the equivalent using HttpNoBody.
    // Your application creates a new, empty response object which is passed 
    // in the last argument and filled with the HTTP response upon success.

    Get Create (RefClass(cComChilkatHttpResponse)) To hoResp2
    If (Not(IsComObjectCreated(hoResp2))) Begin
        Send CreateComObject of hoResp2
    End
    Get pvComObject of hoResp2 to vResp2
    Get ComHttpNoBody Of hoHttp "HEAD" sUrl vResp2 To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp2 To iTemp1
    Showln iTemp1


End_Procedure