tags:

views:

23

answers:

1

Hello,

I login to a website and it returns a cookie via the header. The cookies name is fb_cookie. I try to read it with the below PHP code but it returns nothing. How can I fetch a cookie set via the header?

echo $_COOKIE["fb_cookie"];

The response is this from the header (read by the Poster plugin in Firefox).

fb_cookie=1554e662b9914b5d640d655f-627185705%7C6LneHfe-wWAworIG2hTHSzxuqkw.; path=/; expires=Thu, 07-Jul-2011 12:57:05 GMT _lambda_session=BAh7BzoMdXNlcl9pZGkBkToPc2Vzc2lvbl9pZCIlOGY2Y2U2ZDhlMDcyNTdjMDM4ZjYyNjQ4ZmU5OGU1ZTU%3D--3e60eb15a406a9320f7ab83fb7e0866198f4b6c7; path=/; HttpOnly

Please help!

A: 

$_COOKIE contains the cookies the user sends to your PHP page. You want the cookie which another page sends to you.

If you use curl to retrieve the page, the CURLOPT_COOKIEJAR option may help.

Sjoerd
I will actually want to use the cookie in a CURL request. I know the cookie is set because if I hard code the name and value of the cookie it works fine to retreive information. curl_setopt($c, CURLOPT_COOKIE, 'fb_cookie=1554e662b9914b5dfdd640d655f-627185705|6LneHfe-wWAworIG2hTHSzxuqkw.');