Re: cURL & cookies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/25/06, Richard Lynch <ceo@xxxxxxxxx> wrote:Oh, and here's the REAL
problem:

>
> If you use CURLOPT_HEADER, 1, then, like, for some reason beyond my
> ken, the COOKIEJAR/COOOKIEFILE stuff just plain doesn't get done.
>
> This really sucks if you need *other* headers and want curl to manage
> the Cookies for you, but there it is.
>
> I'm not sure if I remembered to file a bug report on that or not...
>
> If the general conscensus on this list is that CURLOPT_HEADER "on"
> should not negate the use of CURLOPT_COOKIEFILE and/or
> CURLOPT_COOKIEJAR, then we may want to file a bug report...
>
> But I strongly suspect that bug report would most correctly go to
> curl, and not PHP, since I doubt that PHP does anything to screw this
> up -- it's probably all in curl itself, no?
>
> Or maybe me and Peter are the only 2 guys on the planet that think you
> should get to have both...
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Richard,

On an application I was forced to write, the goal was to create an interface
to another system on another server.  I used cURL to grab the pages.  Their
system sent three cookies and used tons of redirects to set their session
and validate logins.  So basically I ended up with something like this:

define('_COOKIEJAR',     '/tmp/cjar_'. session_id());
define('_COOKIEFILE',     _COOKIEJAR);

curl_setopt($curl, CURLOPT_COOKIEJAR, _COOKIEJAR);
curl_setopt($curl, CURLOPT_COOKIEFILE, _COOKIEJAR);
curl_setopt($curl, CURLOPT_HEADER, TRUE);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);

I'm sure this is all wrong, but it was all I could come up with. ;)

I have headers turned on so that I can parse them to get the header redirect
history so that I can track a sort of "browser history."  Curl just reported
the original url even though I was three redirects away from what curl
thinks it is.

My point is that I have headers turned on and the cookie jar files get wrote
to /tmp.  So am I misunderstanding that you said it is one or the other?

Let me know if I'm wrong, thanks!

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux