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 6337751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:18:38+00:00 2026-05-24T19:18:38+00:00

I am currently learning PHP and I want to start incorporating Facebook basic elements

  • 0

I am currently learning PHP and I want to start incorporating Facebook basic elements such as friend lists etc just to do something more fun than building a web shop. However, I have followed the guides on Facebook and added an app and I got the canvas to display what I want, but how do I start getting data from Facebook? I have downloaded this https://github.com/facebook/php-sdk#readme and I added it to my project.

For example, how would I ask for permissions, pull data from my own profile? Do I need to parse JSON? Where is the API for the PHP SDK? This http://developers.facebook.com/docs/reference/api/ does not look like the get user id part here:

require 'php-sdk/src/facebook.php';

$facebook = new Facebook(array(
  'appId'  => 'YOUR_APP_ID',
  'secret' => 'YOUR_APP_SECRET',
));

// Get User ID
$user = $facebook->getUser();

Any points in the right direction would be highly appreciated.

  • 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-24T19:18:38+00:00Added an answer on May 24, 2026 at 7:18 pm

    There is no need to parse JSON, you would have to go about doing an API request:

    try {
        $user_profile = $facebook->api('/me');
    } catch (FacebookApiException $fbException) {
        die('Houston, we got problems.');
        return;
    }
    

    This would leave you with either a $user_profile containing every single element you’ve previously requested permission for (such as first_name, etc), put into an associative array ($user_profile in this case).
    Obviously, you would first have to check for getUser()‘s success or failure (if it returns 0, it failed), as the API call would behave as if you were logged out otherwise.

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

Sidebar

Related Questions

I'm currently learning PHP and MySQL and I have been working from a basic
I'm currently learning PHP and MySQL. I'm just wrote a class that handles all
I currently learning about scrum and want to learn from experienced professionals in the
I'm currently learning the APIs related to Intel's parallelization libraries such as TBB, MKL
I'm currently developing in (learning) ZF1.10. I also just set up a new development
I have a currently running PHP application that I want to add real-time feed
I am currently in the process of learning the CodeIgniter PHP framework. At the
I'm learning currently php/mysql and I'm confused about this bit. After some heads scratching
I'm currently learning php, and I'm testing out oop and classes. My code is:
Hi i am new to php, I currently learning php using eclipse. I know

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.