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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:03:35+00:00 2026-05-16T05:03:35+00:00

I have created a simple Facebook application in PHP, that greets user by there

  • 0

I have created a simple Facebook application in PHP, that greets user by there user name,
I also want there Email id, to be displayed. But i am not able to do that. the code that i am using is,

require_once('facebook.php');
require_once('config.php');
$facebook = new Facebook(APIKEY, SECRETKEY);
$user=$facebook->require_login();

echo $user; // displaying the ID
<div style="padding: 10px;" id="greeting">
   <fb:if-is-app-user uid="loggedinuser">
      <h2>Hi <fb:name firstnameonly="true" uid="loggedinuser" useyou="false"/>! welcome to facebook</h2>
  <fb:else>
       <h2>Hi <fb:name firstnameonly="true" uid="loggedinuser" useyou="false"/>! welcome to facebook</h2>
   </fb:else>
   </fb:if-user-has-added-app>
</div>

the Output that i am getting is,

1000002020202020
Hi User! welcome to facebook

I want the Email address to be displayed along with the user name, i searched many code but did not get any solution. and if you any good facebook tutorial site please post the links too..

  • 1 1 Answer
  • 1 View
  • 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-16T05:03:36+00:00Added an answer on May 16, 2026 at 5:03 am

    You can get the Email Address, directly without using the FQL.

    // initialize facebook
     $facebook = new Facebook(array(
            'appId' => APP_ID,
            'secret' => APP_SECRET));
    
     $session = $facebook->getSession();
     if ($session) {
     try {
        $fbme = $facebook->api('/me');
      } catch (FacebookApiException $e) {
        error_log($e);
      }
    }
    else
    {
      echo "You are NOT Logged in";
    }
    
    //getting the login page if not signned in
    if (!$fbme) {
      $loginUrl = $facebook->getLoginUrl(array('canvas' => 1,
                                          'fbconnect' => 0,
                                          'req_perms' =>                   'email,user_birthday,publish_stream',
                                          'next' => CANVAS_PAGE,
                                          'cancel_url' => CANVAS_PAGE ));
     echo '<fb:redirect url="' . $loginUrl . '" />';
     } else {
    
          // $fbme is valid i.e. user can access our app
         echo "You can use this App";
     }
    
     // getting the profile data
     $user_id = $fbme[id];
     $name=$fbme['name'];
     $first_name=$fbme['first_name'];
     $last_name=$fbme['last_name'];
     $facebook_url=$fbme['link'];
     $location=$fbme['location']['name'];
     $bio_info=$fbme['bio'];
     $work_array=$fbme['work'];
     $education_array=$fbme["education"];
     $email=$fbme['email'];
     $date_of_birth=$fbme['birthday'];
    

    This code worked for me..and i go all the information needed with the Email ID.

    NOTE: User has to allow us to get their Information during the Approval of Application.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a simple facebook app and I want to store the facebook
How to manually create Friendly URLs? (PHP) So I have created simple php file
I have created a simple WordPress plugin that automatically sets my new sites up
Use scenario is pretty simple: I have a desktop only application that could be
I have created a simple Facebook app and added it as a tab page.
I have created a simple blog site with facebook connect to know when a
I've created a simple Facebook app that doesn't need any data/info from users. When
I wrote a simple application for facebook and it seems that i fail to
I have tried almost everything to link picture to Facebook status that is created
I have created a Facebook application and have an application ID and application secret.

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.