Hello friends i'm trying this method for get fb access token, but this is not working....

Return empty value

PHP Code:
    define('FACEBOOK_APP_ID''xxxxxxxxxxxxxxxxxxxxxxxx');
    
define('FACEBOOK_SECRET''xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');

    function 
get_facebook_cookie($app_id$app_secret) {
        
$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 $app_secret) != $args['sig']) {
                return 
null;
            }
            return 
$args;
    }

    
$cookie get_facebook_cookie(FACEBOOK_APP_IDFACEBOOK_SECRET);
        
    echo 
$cookie['access_token'];