homepage Welcome to WebmasterWorld Guest from 54.211.7.174
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Facebook API confusion
The Facebook API does not perform as expected
rasputinsghost




msg:4502409
 10:09 am on Oct 1, 2012 (gmt 0)

Using the following code, I expect to receive the email address in the information supplied by Facebook.
$fbconfig = array(
'appId' => 'app id placed here',
'secret' => 'app secret placed here',
'cookie' => true
);
$fbpermissions = array('req_perms' => 'email');
include("dynamic/facebook.php"); /* load the Facebook SDK */
$facebook = new Facebook($fbconfig); /* create instance of Facebook class */
$user = $facebook->getUser(); /* Get User ID */
if ($user) {
try { /* Proceed knowing you have a logged in user who's authenticated.*/
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}

This is a print_r of what I actually get
Array
(
[id] => 464646461
[name] => Rasputin Ghost
[first_name] => Rasputin
[last_name] => Ghost
[link] => link to rasputin.ghost
[username] => rasputin.ghost
[gender] => male
[timezone] => 2
[locale] => en_US
[verified] => 1
[updated_time] => 2011-03-18T21:59:27+0000
)


As you can see, no email address
I am probably doing something totally stupid but I cannot see what it is.
I think that the app on Facebook is set up correctly - if it was not, I would not get anything back - right?
Any ideas or suggestions - this is driving me around the bend.
Someone made the comment that Facebook may not like me because I had not updated since March 2011 - Is that a possibility?

 

coopster




msg:4507994
 7:16 pm on Oct 14, 2012 (gmt 0)

Which API are you using? Graph?
https://developers.facebook.com/docs/reference/apis/

rasputinsghost




msg:4508553
 7:13 pm on Oct 16, 2012 (gmt 0)

Looks like it is graph - line 702 on base_facebook.php quotes "It relies on Facebook's Graph API"
Any help would really be appreciated - I need it for about 6 sites now.

coopster




msg:4511779
 4:13 pm on Oct 24, 2012 (gmt 0)

>>line 702 on base_facebook.php quotes "It relies on Facebook's Graph API"

Looks like you are using a 3rd party FB wrapper here, a class developed by somebody else. You may have to dig in a little deeper to the code or contact the developer. OR, just use the FB API and ditch the wrapper class.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved