| |
|
|
|
cURL Mailing List Monthly Index Single Mail
curl-users Mailing List Archives
how to get the HTTP HEADERS along with the HTTP Content.
From: Venkataragavan Vijayakumar, TLS-Chennai <venkataragavan.v_at_hcl.in>
Date: Mon, 4 Feb 2008 17:48:11 +0530
Hi all,
The following is the code I returned to get the HTTP Header
But the problem is,
1. If I set callback functions to get header, using
2. If I set CURLOPT_HEADER as 1, then only the header part
So, please anyone see my following code and help me to get the HTTP
Get()
{
CURL *curl;
CURLcode res;
char* data=NULL,*data1=NULL;
char* match = "Etag:";
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl,
curl_easy_setopt(curl,
curl_easy_setopt(curl, CURLOPT_HTTPGET,1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
curl_easy_setopt(curl, CURLOPT_WRITEDATA,
curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
curl_easy_setopt(curl, CURLOPT_HEADER,1);
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION,
curl_easy_setopt(curl, CURLOPT_HEADERDATA,
res = curl_easy_perform(curl);
}
}
Callback functions.
size_t get_xcap_etag( void *ptr, size_t size, size_t nmemb, void
{
if(size*nmemb < 1)
return 0;
if (ptr)
{
*userp = malloc (strlen((char *)ptr) + 1);
strcpy (*userp, (char *)ptr);
return 1;
}
return -1;
}
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void
{
if(size*nmemb < 1)
return 0;
if (ptr)
{
*userp = malloc (strlen((char *)ptr) + 1);
strcpy (*userp, (char *)ptr);
return 1;
}
return -1;
}
Thanks & Regards,
Venkataragavan V
DISCLAIMER:
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
-----------------------------------------------------------------------------------------------------------------------
These mail archives are generated by hypermail. |
Page updated November 12, 2010.
web site info