| |
|
|
|
cURL Mailing List Monthly Index Single Mail
curl-and-php mailing list Archives
RE: How do I keep the $_SESSION info when I curl?
From: Liu Shan Shui <me_at_lx.sg>
Date: Wed, 6 May 2009 05:23:10 +0800
Hi Ted,
That's because the PHP session handler identifies them as two separate
Say, when a visitor visits test1.php for the first time, session_start() is
You can see that in action in the URL below. Test.php corresponds to your
http://submeower.com/p215/test.php
Source code:
Curlx.php - http://code.google.com/p/curlx/
Test.php - http://submeower.com/p215/test.phps
Dump.php - http://submeower.com/p215/dump.phps
One workaround for this would be to serialize the session data in test1.php
With regards,
Liu Shan Shui
me_at_lx.sg
"Life would be much easier if I had the source code." - Anonymous
From: curl-and-php-bounces_at_cool.haxx.se
Yes, that one as well. All of the files include session_start() by the
require_once 'init.php';
Here is the example again.
First, go here to set the $_SESSION variable to something:
http://live-answers.com <http://live-answers.com/>
Now, this page shows the headers and $_SESSION variable before curling:
http://live-answers.com/test.php
This page shows the headers and $_SESSION variable after curling:
http://live-answers.com/test1.php
The cookie "myCurlCookie.txt" is created at that point with the following
# Netscape HTTP Cookie File
# http://www.netscape.com/newsref/std/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
www.live-answers.com FALSE / FALSE 0 PHPSESSID
Ted
_____
From: Stephen Pynenburg [mailto:spynenburg_at_gmail.com]
Session_start() also has to be called from the second page you're requesting
On Mon, May 4, 2009 at 22:12, Edward E. Murphy <ted_at_speak-tome.com> wrote:
Yes, session_start() is called within init.php.
Ted
_____
From: Stephen Pynenburg [mailto:spynenburg_at_gmail.com]
Just to ensure the PHP side is correct, if you want PHP to resume a session
On Mon, May 4, 2009 at 20:12, Edward E. Murphy <ted_at_speak-tome.com> wrote:
Hello all,
I have searched for this to no avail, please help.
I want to use cURL to redirect from one file to another. The redirect works
Here is what I am using now (doesn't work). The COOKIEJAR file at
<?php
// fileurl is http://www.live-answers.com/test1php
// this sets a bunch of $_SESSION cookie info
require_once 'init.php';
// use curl to redirect the url
function useCurl($URL)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$URL");
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/myCurlCookie.txt" );
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/myCurlCookie.txt");
curl_exec ($ch);
curl_close ($ch);
}
// this calls the second test file, where the $_SESSION info is not
$URL="http://www.live-answers.com/test2.php";
useCurl($URL);
exit;
?>
Best regards,
Ted
_______________________________________________
_______________________________________________
These mail archives are generated by hypermail. |
Page updated November 12, 2010.
web site info