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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:12:44+00:00 2026-05-31T15:12:44+00:00

I have read through this post over and over, and yet it doesn’t make

  • 0

I have read through this post over and over, and yet it doesn’t make sense to me.

What I am trying to do is acquire a Facebook user’s email address so that I can store it in a string and compare to see if it matches the emails of existing users in my MySQL database. I only need to to do this when the user first grants access rights to the app.

In the “Authenticated Referrals” section of my app developer interface, I have set “User & Friend Permissions” to include “email”.

Within the “canvas” area of my site, I have this code:

include('facebook/base_facebook.php');
include('facebook/facebook.php');
$facebook = new Facebook(array(
    'appId'  => "XXXXXXXXXXXXXXX",
    'secret' => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
));
$user = $facebook->getUser();
if ($user)
{
    try {
        $user_profile = $facebook->api('/me');
    } catch (FacebookApiException $e) {
        $user = null;
    }
}

If I var_dup() $user, I can see the user id (though not much else) which seems to be correct, so I believe I’m connecting to the right place on Facebook.

But then there was this suggested line of code, which implies that it returns an email address, but when I echo it out to see what it looks like, it doesn’t return an email address:

echo "<br/>" . $facebook->getLoginUrl(array('req_perms' => 'email'));

I kind of thought it wouldn’t, as it doesn’t look quite right to me, but on the other hand, I just have no idea what else to do with it or where to put it.

And then I also came across this post, which has code mixed in with the HTML in a way that baffles me even further.

Assuming that my user has granted permission for my app to see their email, isn’t there a simple way of getting at it? Something an inexperienced programmer like myself can grasp?

  • 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-31T15:12:45+00:00Added an answer on May 31, 2026 at 3:12 pm

    You are using outdated method. You can use the code below to retrieve the email.

    You can find more information about Facebook Connect from : http://25labs.com/tutorial-integrate-facebook-connect-to-your-website-using-php-sdk-v-3-x-x-which-uses-graph-api/

    $app_id     = "xxxxxxxxx";
    $app_secret = "xxxxxxxxxx";
    $site_url   = "xxxxxxxxxxxxx";
    
    include_once "src/facebook.php";
    
    $facebook = new Facebook(array(
        'appId'     => $app_id,
        'secret'    => $app_secret,
        ));
    
    $user = $facebook->getUser();
    
    if($user){
        try{
            $user_profile = $facebook->api('/me');
        }catch(FacebookApiException $e){
            $user = NULL;
        }
    }
    
    if($user){
        $logoutUrl = $facebook->getLogoutUrl();
    }else{
        $loginUrl = $facebook->getLoginUrl(array(
            'scope'         => 'email',
            'redirect_uri'  => $site_url,
            ));
    }
    
    if($user){
        Echo "Email : " . $user_profile['email'];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read through Scott Hanselman's post on this topic. I found another article
I'm trying to have my application read through a text file and look for
I have already read through this . However, in my case the page I
I have read through several reviews on Amazon and some books seem outdated. I
I have read through the solutions to similar problems, but they all seem to
I have read through the Rails docs for Routing , Restful Resources , and
Okay guys, I have read through all the other posts and question on jQuery
Ok, I'm programming in objective-C and using Xcode. I have read through the documentation
I have read the boost asio reference, gone through the tutorial and looked at
I have a web server which is protected behind http-basic-auth. I've read through the

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.