- Subject: libCurl in C
- From: Jai Sharma <jai.unix@xxxxxxxxx>
- Date: Wed, 21 Jan 2009 02:13:04 +0530
- List-id: <linux-c-programming.vger.kernel.org>
Dear Friends,
I am using CURL to get HTTP response.
The default output for CURL is stdout, but i am unable to change it to
a variable.
Right now,
I am using a temporary file for this purpose and read it to process it.
Is there any way, by which method i will get CURL output to a string
or any structure?
===================== main.c =====================
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
int
main()
{
CURL *curl;
char *data1[512];
FILE *fp;
fp = fopen("/tmp/curl","w");
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1");
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
fclose(fp);
return 0;
}
================================================
Thanks and Regards
Jai
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Assembler]
[Git]
[Kernel List]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[Yosemite Campsites]
[Yosemite News]
[GCC Help]