Created
November 14, 2012 08:28
-
-
Save sunny0425/4070990 to your computer and use it in GitHub Desktop.
use fql and fb_graph to search friends by user name for facebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reference: | |
# - https://github.com/nov/fb_graph | |
# - https://gist.github.com/752914 | |
# - http://developers.facebook.com/docs/reference/fql/ | |
# - http://stackoverflow.com/questions/7352296/facebook-fql-search-page-with-strpos-doesnt-work | |
require 'fb_graph' | |
user_access_token = 'USER_ACCESS_TOKEN' | |
fb_user = FbGraph::User.me(user_access_token) | |
FbGraph::Query.new("SELECT uid, name, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND strpos(lower(name),'hen') > 0").fetch(user_access_token) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment