curl-library
Re: CURLOPT_WRITEDATA not passed to CURLOPT_HEADERFUNCTION?
Date: Thu, 16 Jan 2003 18:25:06 +0100 (MET)
On Thu, 16 Jan 2003, Dave Weis wrote:
> This is what I'm doing but the parameter never makes it to the header
> callback, it's null in the callback:
Use the HEADERDATA for the headerfunction:
#include <curl/curl.h>
size_t my_headers(char *data,
size_t size, size_t nitems,
void *myowncrap)
{
fprintf(stderr, "Got %d bytes: %s", size * nitems, myowncrap);
return size * nitems;
}
int main(void)
{
CURL *curl;
curl = curl_easy_init ();
curl_easy_setopt (curl, CURLOPT_URL, "http://daniel.haxx.se/");
curl_easy_setopt (curl, CURLOPT_HEADERDATA, "I am here where are you?\n");
curl_easy_setopt (curl, CURLOPT_HEADERFUNCTION, my_headers);
curl_easy_perform (curl);
curl_easy_cleanup(curl);
return 0;
}
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- This SF.NET email is sponsored by: Thawte.com Understand how to protect your customers personal information by implementing SSL on your Apache Web Server. Click here to get our FREE Thawte Apache Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029enReceived on 2003-01-16