note 87112 added to function.curl-setopt
| From: | saidk at phirebranding dot com | Date: | Wed, 19 Nov 2008 21:31:11 +0000 |
| Subject: | note 87112 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146728@lists.php.net to get a copy of this message | ||
Passing in PHP's $_SESSION into your cURL call:
session_start();
$strCookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'] . '; path=/';
session_write_close();
$curl_handle = curl_init('enter_external_url_here');
curl_setopt( $curl_handle, CURLOPT_COOKIE, $strCookie );
curl_exec($curl_handle);
curl_close($curl_handle);
This worked great for me. I was calling pages from the same server and needed to keep the $_SESSION
variables. This passes them over. If you want to test, just print_r($_SESSION);
Enjoy!
----
Server IP: 69.147.83.197
Probable Submitter: 99.189.63.78
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/87112
Del: integrated -- https://master.php.net/note/delete/87112/integrated
Del: useless -- https://master.php.net/note/delete/87112/useless
Del: bad code -- https://master.php.net/note/delete/87112/bad+code
Del: spam -- https://master.php.net/note/delete/87112/spam
Del: non-english -- https://master.php.net/note/delete/87112/non-english
Del: in docs -- https://master.php.net/note/delete/87112/in+docs
Del: other reasons-- https://master.php.net/note/delete/87112
Reject -- https://master.php.net/note/reject/87112
Search -- https://master.php.net/manage/user-notes.php