cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: getting header information

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Wed, 3 Jan 2007 05:14:28 -0600

On 1/3/07, kuriakose <kuriakose_at_huawei.com> wrote:
>
> How do I get the information like size of the file and date time of file in
> the server
>
> without downloading.
>
> One way is set CURLOPT_NOBODY and give a call back function so that the
> header information is written to a file
>
> And then read from the file. Is there some other way to get these info
> directly in code.

Why not use CURLOPT_HEADERFUNCTION and set your own callback to
process the headers?? Man page says:

              Function pointer that should match the following prototype:
              size_t function( void *ptr, size_t size, size_t
nmemb, void *stream);
              This function gets called by libcurl as soon as it
has received header
              data. The header callback will be called once for each
header and only
              complete header lines are passed on to the callback.

Ralph Mitchell
Received on 2007-01-03