curl-library
How to download a zip file using http
Date: Tue, 19 Nov 2013 19:18:28 -0500
I am wondering since i am a little confused on how to download a zip
file from a url like www.example.com/test.zip? I have looked at the
examples such as simple.c but that only returns the source of the page.
I than tried to do something like this (idk if it would be better as a
attachment or not).
#include <stdio.h>
#include <curl.h>
int
main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL,
"http://example.com/test.zip");
/* Perform the request, res will get
the return code */
res = curl_easy_perform(curl);
/* Check for errors
*/
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed:
%sn",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
system("PAUSE"); //so i can read what it
outputs.
}
return 0;
}
It returns PK♣♠ so something is not right
here and i am using this on c++ but i have not found a problem with
cc++.
So how do i download a zip from a url?
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-11-20