i'm using php as a middle layer to hit a web api for an ajax front end. this web api sets and reads cookies upon each call after a successful authenticated login, so i needed a way to simulate this since this request isn't being made from a browser, but a web server.
the problem here is the use of curl's CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE to satisfy that need. these read and write to a server-side text file which in my situation will be accessed hundreds to thousands of times a minute or more on a high-traffic site.
google hasn't helped me, but i'm worried that this may not be efficient enough for an enterprise-level web application. can anyone comment on this or provide their own personal experience on the matter.
one obvious options are passing the data to the client, which will pass it back for subsequent requests and then injected into the header data manually. but this is dirty, and also a bit chatty for all the subsequent ajax calls. any better ideas? i'm better versed in other server-side languages/technologies still, so there may be something out of the box i'm just unaware of. thanks.
persist cookie data without using CURLOPT_COOKIEJAR?
Moderator: General Moderators
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: persist cookie data without using CURLOPT_COOKIEJAR?
Code: Select all
curl_setopt($c, CURLOPT_COOKIE, 'city=' . $cities[$pid_index][0]);Re: persist cookie data without using CURLOPT_COOKIEJAR?
thanks, but that's not really what I'm after.
is it possible to read/intercept what would be pushed to the cookiejar? i don't like the idea of manually parsing the headers for this if there's a more direct way.
basically, i could just dump this data in a client-side cookie and then pass them back in using CURLOPT_COOKIE.
is it possible to read/intercept what would be pushed to the cookiejar? i don't like the idea of manually parsing the headers for this if there's a more direct way.
basically, i could just dump this data in a client-side cookie and then pass them back in using CURLOPT_COOKIE.
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: persist cookie data without using CURLOPT_COOKIEJAR?
Noscanf wrote:is it possible to read/intercept what would be pushed to the cookiejar?
Please correct me if I'm wrong. I had same problem long time ago. The only solution I found is to parse headers.
Re: persist cookie data without using CURLOPT_COOKIEJAR?
yeah, i kinda figured that and already started down that path. thanks.DigitalMind wrote: No
Please correct me if I'm wrong. I had same problem long time ago. The only solution I found is to parse headers.