简体   繁体   中英

possible to sort facebook friends birthdays from a graph api fetch?

If I am using the following to get my friends birthdays:

$facebook->api('/me/friends/?fields=id,first_name,last_name,birthday,picture');

is it possible to sort the result by descending birthdays? (soonest is first)

thanks!

You can accomplish that by using an FQL request:

$facebook->api('/me/fql?q=SELECT+uid,first_name,last_name,birthday_date,pic+FROM+user+WHERE+uid+IN+(SELECT+uid2+FROM+friend+WHERE+uid1+=+me())+order+by birthday_date');

Keep in mind that not everyone provides a birthday and birthday_date values can be null .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM