Hello All,
I have been trying hard for the last 5 hours or so to get the facebook users' birthday through facebook connect but I have not managed to do so. The same code worked previously and still works on other sites made earlier (old ones) but does not seem to work again. Here is the code:
require_once ('./connect/facebook.php');
$facebook = new Facebook("myapi", "mysecret");
$fbuser = $facebook->get_loggedin_user();
if ($fbuser)
{
$_SESSION['custid'] = $fbuser;
$fb_look_fields = array(
'name',
'first_name',
'last_name',
'name',
'timezone',
'name',
'sex',
'birthday',
'birthday_date',
'current_location',
'proxied_email',
'affiliations'
);
try
{
$user_data = $facebook->api_client->users_getInfo($fbuser, $fb_look_fields);
}
catch (Exception $e)
{
echo $e->getMessage();
}
# for birth date
$fb_birthday = $user_data[0]['birthday'];
if (!$fb_birthday)
{
$fql_result_xml = $facebook->api_client->fql_query("SELECT birthday FROM standard_user_info WHERE uid = " . $fbuser);
$fb_birthday = $fql_result_xml['birthday'];
}
echo $fb_birthday;
The birthday is always empty even though i have set it to visible to all.
- I am using new facebook php client
- I even tried getting info from standard table but without any luck
Has facebook changed their API/Policy again?
Or what is I am missing/not doing correctly there in the code?
I would really appreciate your help and ideas.
Thanks.