开发者

find if a facebook user is single or married - facebook api

how can i do a search like this to search if an user is single or married?

$_friend开发者_JS百科s = $facebook->api(array( 'method' => 'fql.query', 'query' => 'SELECT uid, name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$uid.' ) AND sex<>"'.$me['gender'].'"', ));


Something like this would do:

SELECT relationship_status FROM user WHERE uid=me()

Or to get your friends relationship status too:

SELECT relationship_status FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())

For the first one, you need the user_relationships permission and for the later you need friends_relationships.

Result would be something like:

[
  {
    "relationship_status": "In a relationship"
  }
]

A SIDE NOTE:
You need to be careful comparing the sex and relationship_status fields against one value since the documentation is not clear how these fields are handled. More about this are described on this bug. (BTW please vote for the bug!)


I think facebook got new API for getting user status... not sure the code u mention above still working though.

http://developers.facebook.com/docs/reference/api/
http://developers.facebook.com/docs/authentication/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜