3
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
9
return CURL_READFUNC_ABORT;
15
CURLcode res=CURLE_OK;
17
curl = curl_easy_init();
19
/* First set the URL that is about to receive our POST. */
20
curl_easy_setopt(curl, CURLOPT_URL, URL);
22
/* Now specify we want to POST data */
23
curl_easy_setopt(curl, CURLOPT_POST, TRUE);
25
/* Set the expected POST size */
26
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 1);
28
/* we want to use our own read function */
29
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
31
/* pointer to pass to our read function */
32
curl_easy_setopt(curl, CURLOPT_INFILE, NULL);
34
/* get verbose debug output please */
35
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
37
/* include headers in the output */
38
curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);
40
/* Perform the request, res will get the return code */
41
res = curl_easy_perform(curl);
44
curl_easy_cleanup(curl);