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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:55:53+00:00 2026-05-17T15:55:53+00:00

I am doing a registration on my website via facebook. When the user logs

  • 0

I am doing a registration on my website via facebook.

When the user logs in via facebook the $user array returned is not exactly what i want.

I have gone through the user parameters that are accessible via facebook, i have tried implementing them also but it is not working.

This is a sample of what i have

require_once "Database_Connect.php";
if (!isset($_POST['choosepassword']))
{
 # We require the library
 $user=array();
 require("facebook.php");
 # my error tracker
 $error=0;

 # Creating the facebook object
 $facebook = new Facebook(array(
  'appId'  => 'xxx',
  'secret' => 'xxx',
  'cookie' => true
 ));

 # Let's see if we have an active session
 $session = $facebook->getSession();

 if(!empty($session)) {
  # Active session, let's try getting the user id (getUser()) and user info (api->('/me'))
  try{
   $uid = $facebook->getUser();
   $user = $facebook->api('/me');
  } catch (Exception $e){}

  if(!empty($user)){
   # User info ok? Let's print it (Here we will be adding the login and registering routines)
   print_r($user);

   ***At this point what is retrieved is not exactly what i want*****

   $ue=$user['email'];$ui=$user['id'];
   $query = mysql_query("select * from members where email = '$ue' or (oauth_provider = 'facebook' AND oauth_uid = '$ui')", $link);
   $result = mysql_fetch_array($query);

   # If not, let's add it to the database
   if(!empty($result)){
    $error = 2; //record already in database
    require_once "facebook_error.php";
    die();
   }
  } else {
   # For testing purposes, if there was an error, let's kill the script
   $error = 1; //we were unable to retrieve info frm facebook
   require_once "facebook_error.php";
   die();
  }
 } else {
  # There's no active session, let's generate one
  $login_url = $facebook->getLoginUrl();

 *** I tried specifying what i want returned here, but it doesnt seem to work*****

  $url = $facebook->getLoginUrl(array(
  'req_perms' => 'uid, first_name, last_name, name, email, current_location, user_website, user_likes, user_interests, user_birthday, pic_big',
  'next' => 'http://www.zzzzzzz.com/facebook_register.php',
  'cancel_url' => 'http://www.zzzzzzz.com'

 ));
  header("Location: ".$login_url);
 }

What am i not doing right?

Thank You

Update

I am using FQL to select user info from facebook now,

$fql    =   "select uid, first_name, last_name, name, sex, email, current_location, website, interests, birthday, pic_big from user where uid=me()";
            $param  =   array('method' => 'fql.query', 'query' => $fql, 'callback' => '');
            $user   =   $facebook->api($param);

It retrieves all the data except the birthday and the email

How can i select the email and birthday?

Thanks

  • 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-17T15:55:54+00:00Added an answer on May 17, 2026 at 3:55 pm

    Your application needs the user_birthday and email permissions for this, else it will not return that information. You only need to supply parameters that need a permission, not what fields you want in the req_perms parameter, so it should look like this:

    $url = $facebook->getLoginUrl(array(
      'req_perms' => 'email, user_birthday',
      'next' => 'http://www.zzzzzzz.com/facebook_register.php',
      'cancel_url' => 'http://www.zzzzzzz.com'
     ));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website, with a user system. I want to integrate wordpress's user
I would like to have the authentication and registration parts of my website encrypted
I'm trying to use Facebook's registration tool for my website. I would like to
I just started c++ today. I am doing some simple registration program. I want
I want to integrate the same registration process that Stack Overflow has into my
So I'm building my first ever website with user accounts. What data should I
I am building an online article website. I have a php script called view_article.php
I would like to make a simple user login/registration system using PHP and mysql.
So this is basically a reassurance that I'm doing the whole registration/login process right
I have a API that is ran on multiple sites. The user can register

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.