Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #8104
| From | bill <william@TechServSys.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: cURL and $_SESSION |
| Date | 2013-01-20 13:53 -0500 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <kdhefo$dlt$1@speranza.aioe.org> (permalink) |
| References | <kdh8qq$u4k$1@speranza.aioe.org> <kdh947$uqf$1@speranza.aioe.org> <4daof8tqhoam7jg75aiarj1s6n4uk03h3g@4ax.com> |
On 1/20/2013 12:30 PM, Richard Yates wrote: > On Sun, 20 Jan 2013 12:22:25 -0500, bill <william@TechServSys.com> > wrote: > >> On 1/20/2013 12:17 PM, bill wrote: >>> I am invoking a script via cURL, with POST variables. Seems to >>> work fine, but... >>> >>> On the first invocation I set a session variable, when I return >>> to the same script via cURL from the same computer (with a >>> different command) the session array is empty. >>> >>> I verified that I am setting the session variable correctly. >>> >>> What is special about using Session when invoking a script via cURL >>> >>> -bill >> >> yes, I do session_start (); as the first executable line in the >> script. >> >> -bill > > This looks like the solution: > > http://www.smooka.com/blog/2009/07/24/maintaining-php-session-when-using-curl/ > That did not do the job, but gave me a hint. I fixed the problem by adding: curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt'); curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt'); so that curl would know where to save the SESSION Cookie and where to find it for the next script. -bill
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cURL and $_SESSION bill <william@TechServSys.com> - 2013-01-20 12:17 -0500
Re: cURL and $_SESSION bill <william@TechServSys.com> - 2013-01-20 12:22 -0500
Re: cURL and $_SESSION Richard Yates <richard@yatesguitar.com> - 2013-01-20 09:30 -0800
Re: cURL and $_SESSION bill <william@TechServSys.com> - 2013-01-20 13:53 -0500
Re: cURL and $_SESSION bill <william@TechServSys.com> - 2013-01-20 12:25 -0500
csiph-web