Sample code for 30+ languages & platforms
Unicode C

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 Unicode C Downloads

Unicode C
#include <C_CkHttpW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkHttpW http;
    const wchar_t *localFilePath;

    success = FALSE;

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

    http = CkHttpW_Create();

    CkHttpW_SetRequestHeader(http,L"Host",L"chilkatsoft.com");

    localFilePath = L"/temp/hamlet.zip";
    success = CkHttpW_Download(http,L"http://107.180.46.206:80/hamlet.zip",localFilePath);
    if (success != TRUE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        return;
    }

    wprintf(L"OK!\n");


    CkHttpW_Dispose(http);

    }