Sample code for 30+ languages & platforms
PureBasic

Example: Http.ClearHeaders method

Demonstrates how to call the ClearHeaders method.

Also see: Chilkat Http Default and Auto-Filled Headers

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkHttp.pb"

Procedure ChilkatExample()

    success.i = 0

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ; Add a request header.
    CkHttp::ckSetRequestHeader(http,"X-Something","1234")
    CkHttp::ckSetRequestHeader(http,"X-Example","5678")

    responseBody.s = CkHttp::ckQuickGetStr(http,"https://chilkatsoft.com/helloWorld.txt")
    ; Examine the request header we just sent..
    Debug CkHttp::ckLastHeader(http)
    Debug "----"

    ; Output:

    ; GET /helloWorld.txt HTTP/1.1
    ; Host: chilkatsoft.com
    ; Accept: */*
    ; Accept-Encoding: gzip
    ; X-Something: 1234
    ; X-Example: 5678

    ; Remove the request headers we previously added:
    CkHttp::ckClearHeaders(http)

    responseBody = CkHttp::ckQuickGetStr(http,"https://chilkatsoft.com/helloWorld.txt")
    Debug CkHttp::ckLastHeader(http)

    ; Output:

    ; GET /helloWorld.txt HTTP/1.1
    ; Host: chilkatsoft.com
    ; Accept: */*
    ; Accept-Encoding: gzip


    CkHttp::ckDispose(http)


    ProcedureReturn
EndProcedure