Facebook PHP API Search, Sort by friends first -
i searching through users using facebook php api, below:
$fb_friends = $this->facebook->api('/search?q=polo&type=user&fields=id,name,first_name,last_name,gender,location,picture.width(215)');
is possible have returned users sorted friends first? if not, how can retrieve friends using api ('/me/friends/'), ones match query string 'polo' ? possible without fql?
fql handy way results way want. example of getting friends , ordering them last name follows:
$fql = "{\"q1\":\"select uid2 friend uid1=me()\","; $fql .= "\"q2\":\"select name, uid user uid in (select uid2 #q1) order last_name asc\"}"; $fqlurl = "https://graph.facebook.com/fql?q=".urlencode($fql)."&access_token=".$fbtoken; $fqr = file_get_contents($fqlurl); $fq = json_decode($fqr, true); $friends = $fq['data'][1]['fql_result_set'];
facebook's fql documentation decent place start if want learn more fql. while decent job explaining query syntax, example code kind of throws lot of code @ though without breaking down, have above essence of it. let me know if you're looking for, , if have questions :)
Comments
Post a Comment