How to detect default avatar on facebook?

前端 未结 4 787
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 07:17

How to detect default avatar on the link like this: https://graph.facebook.com/\'.$id.\'/picture?type=large? Is it the only way to get avatars (male/female) fr

4条回答
  •  不要未来只要你来
    2021-01-14 08:16

    You can use the redirect=false parameter:

    https://graph.facebook.com/naitik/picture?redirect=false

    Then facebook's responce is json and contains this data:

    {
       "data": {
          "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/157337_5526183_369516251_q.jpg",
          "is_silhouette": false
       }
    }
    

    You can use the is_silhouette option to detect if the photo is default one.

    You can read more at: https://developers.facebook.com/docs/reference/api/using-pictures/

提交回复
热议问题