curl-library
CURLOPT_WRITEDATA to FILE
Date: Thu, 3 Feb 2011 19:39:30 -0600
I am trying to follow provided examples, to send HTTP data out to a file. The following code will not successfully
send HTTP to the file ("output). Can someone please help me understand what is wrong with it?
size_t my_write_func(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
return fwrite(ptr, size, nmemb, stream);
}
GLvoid glCurl(void) // Where CURL Happens
{
FILE *outfile;
outfile = fopen("outfile", "w");
CURL *curl;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_write_func);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookies");
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookies");
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)");
curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(curl,CURLOPT_CAINFO, "cacert.pem");
curl_easy_setopt(curl, CURLOPT_URL, "http://www.greenwayford.com/used-inventory/index.htm?reset=InventoryListing");
curl_easy_cleanup(curl);
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-04