curl-users
Why is curl_easy_perform() outputting "1" to the console?
Date: Thu, 01 Nov 2007 20:32:15 -0700
Hello,
This may be a rather easy question but I can't seem to figure it out.
Why is curl_easy_perform() outputting '1' to the console each time its
called?
(I'm running it on debian linux and I'll include current code just in
case)
Thank you,
Daniel
void
SendConf(char* tid, const char* cmdSvr)
{
CURL *curl;
FILE *fp;
char URL[128];
char postfields[256] = "";
int linePointer = 0;
char line[128] = "";
char confData[1024] = "";
fp = fopen(CONF_PATH, "r");
if (NULL == fp){
printf("failed to open the configuration file at SendConf()\n");
} else {
while( fgets(line, sizeof(line) - 1, fp) != NULL ) {
// Copy the contents to confData
strncpy(confData + linePointer, line, strlen(line));
linePointer += strlen(line);
}
fclose(fp);
}
sprintf(postfields, "config=%s", confData);
curl = curl_easy_init();
if (curl == NULL) {
printf("Error init libcurl!\n");
}
sprintf(URL, "http://%s/pf/configManager.php?tid=%s&mode=save", cmdSvr,
tid);
curl_easy_setopt(curl, CURLOPT_URL, URL);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postfields);
curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
Received on 2007-11-02