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

  • SEARCH
  • Home
  • 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 8793319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:06:27+00:00 2026-06-13T23:06:27+00:00

At my index.php I create an Facebook Object and use it to get the

  • 0

At my index.php I create an Facebook Object and use it to get the UserID.

$facebook = new Facebook(array(
'appId' => FACEBOOK_APP_ID,
'secret' => FACEBOOK_SECRET,
'cookie' => true
));

I also make some API Requests and everything is fine.

Now I switch to another subpage (events.php – which is mostly the same as index.php).
But here I can’t access the USER ID with

$user = $facebook->getUser();

It’s always 0. As I said, the commands to create the Facebook Object is the same – only another webpage as index.php.

//edit – just found out that it’s not only a Firefox problem as I thought before.

  • 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-06-13T23:06:28+00:00Added an answer on June 13, 2026 at 11:06 pm

    Make sure you are passing the $facebook session variable to your new page (events.php). A return of 0 means that there is no logged in user, and therefore the session hasn’t been instantiated.
    https://developers.facebook.com/docs/reference/php/facebook-getUser/

    Here are some more helpful docs explaining how to get the current user/session using the Facebook PHP SDK: https://developers.facebook.com/blog/post/503/

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

Sidebar

Related Questions

If I create an object inside of the main scope: INDEX.PHP: $db = new
Is it possible to create an array with a settings file? In the index.php
pls help me how to create a .htaccess file as index.php?regional=aaa domain.com/aaa/ list.php?regional=aaa&ctg=bbb&orderby=ccc&page=123 domain.com/list/aaa/bbb/ccc/123/
i have two files:(localhost/template/) index.php template.php each time when i create an article(an article
I'm trying to create tiny urls like this: site.com/abc123 goes to: site.com/index.php?token=abc123 but I
I'm using the Facebook php-sdk to get the users name and friends, right now
Running the example code for the Facebook API I get a null session object,
I've heard this many and many times: create a index.php on every folder in
I'm totally new to PHP and MySQL but I'm implementing the Facebook PHP SDK
I am working on a new PHP framework for personal use in future projects,

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.