Sample code for 30+ languages & platforms
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 C Downloads

C
#include <C_CkHttp.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkHttp http;
    const char *localFilePath;

    success = FALSE;

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

    http = CkHttp_Create();

    CkHttp_SetRequestHeader(http,"Host","chilkatsoft.com");

    localFilePath = "/temp/hamlet.zip";
    success = CkHttp_Download(http,"http://107.180.46.206:80/hamlet.zip",localFilePath);
    if (success != TRUE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        return;
    }

    printf("OK!\n");


    CkHttp_Dispose(http);

    }