cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Contextual parameter for callback functions?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 9 Apr 2007 12:32:42 -0700

On Mon, Apr 09, 2007 at 12:58:42PM -0600, Evan Gates wrote:
> I'm using cURL's C function
>
> curl_easy_setopt(curlhand, CURLOPT_WRITEFUNCTION, parse_data);
>
> to take the webpage data and parse through it. My problem is I have
> many threads using parse_data as the callback function but no real way
> to tell the actual URL of the data it's getting. Is there anyway to
> access the URL that I'm getting the data for in the callback function?

You can use CURLOPT_WRITEDATA to set the fourth parameter of the write
callback function. It doesn't have to be a FILE* (see the getinmemory.c
example program for an example).

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2007-04-09