views:

250

answers:

1

I can't understand why I can't access the cookies created by facebook connect. I am getting this error msg

Notice: Undefined index:{api_key}_user in xxx

My code is

<?php 
error_reporting(E_ALL);
ini_set("display_errors", 1); 
session_start();
echo $_SESSION['{api_key}_user'];

When using the webdeveloper plugin in firefox I can see the cookie

Name    {api_key}_user 
Value   {user_ID}
Host    .domain.com 
Path    / 
Secure  No
Expires At End Of Session

I have found this http://wiki.developers.facebook.com/index.php/PHP%5FSessions but I do not understand why I need to do that and I have tried it without success.

A: 

Heh heh, I love that someone edited that Facebook wiki page you posted and added my old question as part of the docs. You should read the answer I posted there for background.

I'm going to assume that you're working on an IFrame app, so the first thing that springs to mind is that you're having cross-domain cookie issues.

My initial suggestion would be to set a P3P header in your code (use it before sending any other output of course) and see if that alleviates the problem:

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
zombat

related questions