Sample code for 30+ languages & platforms
Swift

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 Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

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

    let http = CkoHttp()!

    http.setRequestHeader(name: "Host", value: "chilkatsoft.com")

    var localFilePath: String? = "/temp/hamlet.zip"
    success = http.download(url: "http://107.180.46.206:80/hamlet.zip", saveToPath: localFilePath)
    if success != true {
        print("\(http.lastErrorText!)")
        return
    }

    print("OK!")

}