views:

222

answers:

1

Hi

I'm planning to develop a facebook application about horoscopes. So i need users and it's friends birthdate information. Is it possible?

+1  A: 

Yes it is possible, facebook has now turned birthday into extended permission, so you will have to ask for that and only after that you can get the birthday.

This is how you can get birthday once you have asked for the birthday permission from the user:

require_once ('./connect/facebook.php'); // facebook php client library

$facebook = new Facebook("API", "SK");
$fbuser = $facebook->get_loggedin_user();

 $friends = $facebook->api_client->friends_get();
 $friends_parsed = implode(',', $friends);

try
{
    $friends_data = $facebook->api_client->users_getInfo($friends_parsed, 'birthday_date, name');
}
catch (Exception $e)
{
    echo $e->getMessage();
}

foreach($friends_data as $friend_data)
{
       echo $friend_data['birthday_date'] . "<br />";
    }
Sarfraz

related questions