i am trying to read the responde from facebook graph. It send me the access_token but i cant seem to read it. This used to work but for some reason it stopped working today.
$token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $fb_app_id . "&redirect_uri=" . urlencode($fb_return_url) . "&client_secret=" . $fb_app_secret . "&code=" . $code;
$response = file_get_contents($token_url);
$params = null;
parse_str($response, $params);
echo "<pre>";
print_r($params);
echo "</pre>";
$_SESSION['access_token'] = $params['access_token'];
$graph_url = "https://graph.facebook.com/me?access_token=" . $params['access_token'];
$facebook_user_info = json_decode(file_get_contents($graph_url));
The above print_r() shows:
Array
(
[{"access_token":"EAAXZBwzyN6xkBAD0szEptWK6tMJlH68HmmZA6SM2nZBZCoQgPIDAvNaL0Fv9z89nwJhkkRCNRJHvlS9rzn09EdUEbH9ZBVajZAVXlF0SJyoJhW3NvMZAyZB7MOMSbFEsQe4RKSTxiQIZCVxnMPYI3tSxsjxgVZBPZCrbAZD","token_type":"bearer","expires_in":5162746}] =>
)
but $params['access_token'] is always empty. How to properly get the access_token?
thanks