This function was used for me until the day when facebook decided to force some changes.
function get_facebook_cookie() {
$app_id = '[MyAppID]';
$application_secret = '[MyAppSecrect]';
if(isset($_COOKIE['fbs_' . $app_id])){
$args = array();
parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
ksort($args);
$payload = '';
foreach ($args as $key => $value) {
if ($key != 'sig') {
$payload .= $key . '=' . $value;
}
}
if (md5($payload . $application_secret) != $args['sig']) {
return null;
}
return $args;
} else {
return null;
}
}
I was able to access the FB user token as easily as
$cookie['access_token']
Now it seems to me that I can no longer get this information.
I was successfully (easily) able to make the necessary changes to my javascript code, but I'm kind of fixated on the php side. As a quick note, I use codeigniter, and I had a lot of problems trying to get the FB PHP SDK to play well, I also have not seen examples of integrating PHP 3 SDK into codeigniter, so I'm looking for a quick and dirty solution that will allow me to get the access token from cookie, which allows me to use the following Facebook API call:
'https://api.facebook.com/method/friends.getAppUsers?access_token=' . $cookie['access_token'];
Any help is greatly appreciated.