curl-library
need help with POST ing multiple times in a row.
Date: Fri, 1 May 2009 08:33:05 -0600
Hi all,
I have this code, scrubbed for privacy pasted below this message.
When i run it, it will POST correctly the 1st time, then post nothing the
2nd time, Correctly the 3rd , so on and so forth...
Any help would be appreciated,
-Mike Graf
main{
res= curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(!curl){ //Bail out if we cannot init curl_easy
if(DEBUG) { printf("There was an error initializing curl_easy\n");}
return -1;}
while (TRUE) //sleeps for Frequency + some jitter time.
{
//Add the data
curl_formadd(&formpost,&lastptr,
CURLFORM_COPYNAME,"Data",
CURLFORM_COPYCONTENTS,data,
CURLFORM_END);
/* Fill in the submit field too, even if this is rarely needed */
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "submit",
CURLFORM_COPYCONTENTS, "send",
CURLFORM_END);
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
curl_easy_setopt(curl, CURLOPT_URL, config.URL);
res = curl_easy_perform(curl);
/* always cleanup */
curl_formfree(formpost); //clean up the form.. we'll do it again after
some sleep.
sleep(config.Frequency+(rand()%config.Jitter));
}
}
Received on 2009-05-01