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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:36:21+00:00 2026-06-09T07:36:21+00:00

hi i am using facebook graph api PHP SDK . here i am trying

  • 0

hi i am using facebook graph api PHP SDK . here i am trying to get the logged in user’s facebook details , currently i am getting only the basic details which are not required any permissions .

Array
(
    [id] => xxxxxxxxx
    [name] => Kanishka Bandara Panamaldeniya
    [first_name] => Kanishka
    [middle_name] => Bandara
    [last_name] => Panamaldeniya
    [link] => http://www.facebook.com/kanishka.panamaldeniya
    [username] => kanishka.panamaldeniya
    [hometown] => Array
        (
            [id] => 108014839219027
            [name] => Kandy
        )

    [location] => Array
        (
            [id] => 108602292505393
            [name] => Colombo, Sri Lanka
        )

    [quotes] => every action has a reaction....
    [work] => Array
        (
            [0] => Array
                (
                    [employer] => Array
                        (
                            [id] => 234117399957729
                            [name] => Cyber LMJ
                        )

                    [location] => Array
                        (
                            [id] => 108602292505393
                            [name] => Colombo, Sri Lanka
                        )

                    [position] => Array
                        (
                            [id] => 109542932398298
                            [name] => Software Engineer
                        )

                    [start_date] => 2011-08
                )

            [1] => Array
                (
                    [employer] => Array
                        (
                            [id] => 235852306375
                            [name] => eMarketingEye
                        )

                    [position] => Array
                        (
                            [id] => 109542932398298
                            [name] => Software Engineer
                        )

                    [start_date] => 2010-09
                    [end_date] => 2011-08
                )

        )

    [sports] => Array
        (
            [0] => Array
                (
                    [id] => 103992339636529
                    [name] => Cricket
                )

        )

    [favorite_teams] => Array
        (
            [0] => Array
                (
                    [id] => 191485640872790
                    [name] => Sri Lanka Cricket Team
                )

        )

    [favorite_athletes] => Array
        (
            [0] => Array
                (
                    [id] => 185101794860886
                    [name] => Kumara Sangakkara
                )

            [1] => Array
                (
                    [id] => 119473804782315
                    [name] => Angelo Mathews
                )

            [2] => Array
                (
                    [id] => 164574093575397
                    [name] => Kumar Sangakkara
                )

            [3] => Array
                (
                    [id] => 169411436417102
                    [name] => Virat Kohli
                )

            [4] => Array
                (
                    [id] => 166273026737204
                    [name] => Lahiru Thirimanne
                )

            [5] => Array
                (
                    [id] => 101237886616765
                    [name] => Dinesh Chandimal
                )

        )

    [education] => Array
        (
            [0] => Array
                (
                    [school] => Array
                        (
                            [id] => 34663330581
                            [name] => Dharmaraja College-Kandy
                        )

                    [year] => Array
                        (
                            [id] => 138383069535219
                            [name] => 2005
                        )

                    [type] => High School
                )

            [1] => Array
                (
                    [school] => Array
                        (
                            [id] => 112872282058324
                            [name] => University of Colombo School of Computing
                        )

                    [year] => Array
                        (
                            [id] => 140617569303679
                            [name] => 2007
                        )

                    [type] => College
                )

            [2] => Array
                (
                    [school] => Array
                        (
                            [id] => 107577089271805
                            [name] => University of Colombo
                        )

                    [type] => Graduate School
                    [with] => Array
                        (
                            [0] => Array
                                (
                                    [id] => 705760115
                                    [name] => Lasitha Benaragama
                                )

                        )

                )

        )

    [gender] => male
    [timezone] => 5.5
    [locale] => en_US
    [languages] => Array
        (
            [0] => Array
                (
                    [id] => 104023029632921
                    [name] => Sinhala
                )

            [1] => Array
                (
                    [id] => 106059522759137
                    [name] => English
                )

        )

    [verified] => 1
    [updated_time] => 2012-07-29T16:34:22+0000
)

now i want to get fields

*email 
*birth day

and some other permission requesting fields .

so i am doing

    $this->co_config_items = $this->ci->config->item('connections_config');
    $fbconfig = array(
    'appId' => $this->co_config_items['fb_appid'],
    'secret' => $this->co_config_items['fb_secret'],
    'cookie' => true,
    'domain' => $this->ci->config->item('domain')
    );

    $this->ci->load->library('3rd/connectors/facebook', $fbconfig);

    $facebook = new Facebook($fbconfig);
    Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
    Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2;

    $session = $facebook->getSession();

    $url = $facebook->getLoginUrl(array(
                   'canvas' => 1,
                   'fbconnect' => 0,
                   'scope' => 'read_stream,friends_likes,user_birthday'
    ));     

    if(!$session){
        $url = $facebook->getLoginUrl(array(
                   'canvas' => 1,
                   'fbconnect' => 0,
                   'scope' => 'read_stream,friends_likes,user_birthday'

                  ));

        echo "<script type='text/javascript'>window.location = '$url';</script>";
    }
    else{
        //echo "<script type='text/javascript'>window.opener.location.href='" . base_url() . "home/auth/get_user_facebook_details_list" . "'; self.close();
        //</script>";
        try {

            $me = $facebook->api('/me');

            $this->ci->session->set_flashdata ( 'user_details',$me);
            $url=base_url()."home/auth/user_contact_information";               
            echo "<script type='text/javascript'>window.opener.location.href = '$url';self.close();</script>";

        } catch (FacebookApiException $e) {
            $this->ci->message->set_error(array('An errror occured , please try again'));
        }
    }

i am trying to ask permissions by

        $url = $facebook->getLoginUrl(array(
                       'canvas' => 1,
                       'fbconnect' => 0,
                       'scope' => 'read_stream,friends_likes,user_birthday'
)):

but it is not asking for any permission , the default array is always printing . why is that . please help . thanks in advance

  • 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-09T07:36:23+00:00Added an answer on June 9, 2026 at 7:36 am

    i was using the version 2 of PHP sdk , now i am using version 3 , now it is working , thank you very much . i saw some changes in two versions in this function

    version 2

      public function getLoginUrl($params=array()) {
            $currentUrl = $this->getCurrentUrl();
            return $this->getUrl(
                    'www',
                    'login.php',
                    array_merge(array(
                        'api_key' => $this->getAppId(),
                        'cancel_url' => $currentUrl,
                        'display' => 'page',
                        'fbconnect' => 1,
                        'next' => $currentUrl,
                        'return_session' => 1,
                        'session_version' => 3,
                        'v' => '1.0',
                            ), $params)
            );
        }
    

    version 3

     public function getLoginUrl($params=array()) {
        $this->establishCSRFTokenState();
        $currentUrl = $this->getCurrentUrl();
    
        // if 'scope' is passed as an array, convert to comma separated list
        $scopeParams = isset($params['scope']) ? $params['scope'] : null;
        if ($scopeParams && is_array($scopeParams)) {
          $params['scope'] = implode(',', $scopeParams);
        }
    
        return $this->getUrl(
          'www',
          'dialog/oauth',
          array_merge(array(
                        'client_id' => $this->getAppId(),
                        'redirect_uri' => $currentUrl, // possibly overwritten
                        'state' => $this->state),
                      $params));
      }
    

    in version 3 this i can see this additional code

    // if 'scope' is passed as an array, convert to comma separated list
        $scopeParams = isset($params['scope']) ? $params['scope'] : null;
        if ($scopeParams && is_array($scopeParams)) {
          $params['scope'] = implode(',', $scopeParams);
        }
    

    in version 2 , there is nothing called scope .and also

    in version 2

    return $this->getUrl(
                        'www',
                        'login.php',
    

    in version 3

    return $this->getUrl(
              'www',
              'dialog/oauth',
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the education info from Facebook's graph API using stdclass. here's
I'm trying to connect to Facebook's graph api using the PHP-SDK. The session is
Using the Facebook Graph API and the PHP SDK, I know that I can
I am using the PHP library for the Graph API ( http://github.com/facebook/php-sdk ) but
I'm getting an event using Facebook Graph API and PHP using the following code:
I'm trying to use the Graph API and the PHP SDK for Facebook to
I am using Facebook's PHP SDK and Graph API to obtain all albums from
I am creating a facebook applicatioon using PHP-SDK and GRAPH-API. I feel like saving
Using Facebook Graph API (PHP), How to find how long a user is using
I'm using Facebook Connect along with the Facebook Graph API to fetch user's email

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.