Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6537295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:35:59+00:00 2026-05-25T10:35:59+00:00

<?php define(‘YOUR_APP_ID’, ‘x’); define(‘YOUR_APP_SECRET’, ‘x’); function get_facebook_cookie($app_id, $app_secret) { $args = array(); parse_str(trim($_COOKIE[‘fbs_’ .

  • 0
    <?php

define('YOUR_APP_ID', 'x');
define('YOUR_APP_SECRET', 'x');

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(YOUR_APP_ID, YOUR_APP_SECRET);

$url = 'https://graph.facebook.com/me?access_token=' . $access_token;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);

$user = json_decode($response);
print_r($user);

?>
<html>
  <body>
    <?php if ($cookie) { ?>
      Welcome <?php  ?>
    <?php } else { ?>
      <fb:login-button></fb:login-button>
    <?php } ?>
    <div id="fb-root"></div>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <script>
      FB.init({appId: '<?= YOUR_APP_ID ?>', status: true,
               cookie: true, xfbml: true});
      FB.Event.subscribe('auth.login', function(response) {
        window.location.reload();
      });
    </script>
  </body>
</html>

Does anyone know why I am getting this exception? print_r of $user is yielding

stdClass Object ( [error] => stdClass Object ( [type] => OAuthException [message] => An active access token must be used to query information about the current user. ) ) 

Why is this happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:36:00+00:00Added an answer on May 25, 2026 at 10:36 am

    well for one thing $access_token isn’t set before it’s used?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Encryption Classs in php define(ENCRYPTION_KEY,abcdegef); define(INITIALIZATION_VECTOR,mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB), MCRYPT_RAND)); function EncryptString($input)
Here is my code; <?php define (MAX_SIZE,500); function getExtension($str) { $i = strrpos($str,.); if
Done <?php define('FILE_NAME', 'list.dat'); define('MAX_BREAK', 30); function write($file, $ip, $time) { fwrite($file, $ip .
Heres my code: <?php define(THEME, grey); $grey = array(5, 10, 15); $blue = array(1,
it's all in index.php /* Define site root */ defined('DOCUMENT_ROOT') ? null : define('DOCUMENT_ROOT',realpath(dirname(__FILE__)));
C++ preprocessor #define is totally different. Is the PHP define() any different than just
In core.php I can define Configure::write('Routing.admin', 'admin'); and /admin/controller/index will work. but if I
In PHP, if you define a class, and then instantiate an object of that
I want to define something like this in php : $EL = \n<br />\n;
Is it possible to define private variables in a PHP script so these variables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.