0

i want to get some info about facebook user on my page, but when i try to do it - it just returns empty strings, my code:

  $request = new FacebookRequest( $session, 'GET', '/me' );
  $response = $request->execute();
  // get response
  $graphObject = $response->getGraphObject();
        $fbid = $graphObject->getProperty('id');              // To Get Facebook ID
        $fbfullname = $graphObject->getProperty('name'); // To Get Facebook full name
        $femail = $graphObject->getProperty('email');    // To Get Facebook email ID
        $flocation = $graphObject->getProperty('location');
    /* ---- Session Variables -----*/
        $_SESSION['FBID'] = $fbid;           
        $_SESSION['FULLNAME'] = $fbfullname;
        $_SESSION['EMAIL'] =  $femail;
        $_SESSION['location'] =  $flocation;
    /* ---- header location after session ----*/

But it looks like: Facebook empty info

It returns some strings, but last one is empty...

  • During asking permission from your app, if user did not give you permission to access his email ID then it will return empty . (probably its a possibility for this ... right now) – Minar Mnr Jun 16 '17 at 19:00
  • How can i acess that? –  Jun 16 '17 at 19:02
  • if user did not give you permission then you can not .... but if its return empty then show a message to a user that you for accessing this app you need to give me your email id .(possible way) – Minar Mnr Jun 16 '17 at 19:06
  • I know, but how can i ask for more permissions? –  Jun 16 '17 at 19:09
  • 1 . just loop ... you will not logged in user until user gives you email id redirect him to login page . 2 . Or you can logged user then asking for email id and then you verified those email id . – Minar Mnr Jun 16 '17 at 19:14

0 Answers0