Sample code for 30+ languages & platforms
PureBasic

HTTP Download from URL with IP Address and Port

See more HTTP Examples

Downloads a file from a URL using an IP address and port.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkHttp.pb"

Procedure ChilkatExample()

    success.i = 0

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

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

    CkHttp::ckSetRequestHeader(http,"Host","chilkatsoft.com")

    localFilePath.s = "/temp/hamlet.zip"
    success = CkHttp::ckDownload(http,"http://107.180.46.206:80/hamlet.zip",localFilePath)
    If success <> 1
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        ProcedureReturn
    EndIf

    Debug "OK!"


    CkHttp::ckDispose(http)


    ProcedureReturn
EndProcedure