curl-and-php
Re: Proxying cookies with curl
Date: Tue, 28 Oct 2003 17:07:27 -0800 (PST)
Sorry about this, I didn't notice the PHP examples in
the libcurl section of the site.
I'll be able to perform the sort of operation I'm
looking to do with CURLOPT_HEADERFUNCTION.
In case anyone is reading this with the same problem I
had, an example of CURLOPT_HEADERFUNCTION is at
http://curl.haxx.se/libcurl/php/examples/?ex=callbacks.php
Thanks.
--- The Pope Of Chilli Town <baja_666_at_yahoo.com>
wrote:
> I'm working on a simple "proxy" using libCURL (it's
> a
> sort of framework that integrates applications into
> a
> website backend). It's easy enough to proxy POST and
> GET data, but I'm stumbling over how to handle
> cookies.
>
> Essentially, what I want to do is set a local cookie
> (or maybe a session var) that corresponds to any
> cookies recieved or set by the proxied app. I can
> send
> existing cookies with CURLOPT_COOKIE, but I'm
> getting
> stuck on how to retrieve the cookies set by the
> proxied app. I can see the cookie headers with
> CURLOPT_HEADER, but they're sent with the output and
> it's difficult to figure out where the headers end
> and
> the content begins. (will explore this further if I
> can't come up with a more concise solution)
>
> Is there any way of collecting the cookies into an
> array, or at least all headers into a string (so I
> can
> parse out the cookie headers)? I've looked at
> CURLOPT_COOKIEJAR, but I'm not sure if the overhead
> of
> writing a file, reading it, and managing it for
> multiple users would be worth the hassle.
>
> I figured CURLOPT_WRITEHEADER might work with an
> in-memory (or bufferable) file wrapper, like
> php://output or php://stdout, but curl couldn't
> write
> to the former, and I'm not sure how the latter could
> be redirected to a variable or output, so I could
> collect the data using output buffering.
>
> Is there a feature of libcurl that I've missed? Is
> there another approach to this beyond filtering
> cookies out of the headers?
>
> Thanks, I appreciate any input I can get on this.
>
> __________________________________
> Do you Yahoo!?
> Exclusive Video Premiere - Britney Spears
> http://launch.yahoo.com/promos/britneyspears/
>
>
>
-------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback
> Program.
> Does SourceForge.net help you be more productive?
> Does it
> help you create better code? SHARE THE LOVE, and
> help us help
> YOU! Click Here: http://sourceforge.net/donate/
>
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-10-29