curl-library
Re: Retrieving specific header elements
Date: Fri, 8 Feb 2002 09:18:10 +0100 (MET)
On Fri, 8 Feb 2002, Jason Thomas wrote:
> > I don't know how, or if, this is implemented in the PHP binding, but the
> > general libcurl approach is to set a header callback. Then you'll get all
> > headers passed to your function and then you can figure out whatever you
> > want to figure out! ;-)
>
> thats what I'm doing for the moment telling curl to dump the headers and
> parsing them in my php code.
The header callback will always get called with one header at a time and thus
you can check for headers right away instead of dumping them somewhere and
parsing them afterwards. If you'd rather do that.
> so would it be of benefit if you could use 'writeout' to get a particular
> header element?
>
> --write-out header-location
> --write-out header-set-cookie
>
> each of these headers could be stored in a struct if found. then I could
> access them from php
Yes, I think that would be a neat addition. Totally client-side too.
> > BTW, I hope that you've noticed that libcurl can be made to follow
> > Location: headers automaticly if told so.
>
> yep, but I have to send the cookie I got with the redirect. which curl
> doesn't seem todo.
Yes it does, provided you tell it to.
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/Received on 2002-02-08