Saturday 15 March 2014

Facebook PHP-SDK find friends with more likes but only in certain app_id -


I want to remove a list of my friends from facebook php-sdk who "like" certain posts, which only Some apps are from id_id. If you go to www.rottentomatoes.com, you give an example, you can see in the Friends / Friends section, all your friends wrote a review / critic on the movie.

I thought that FQL was a good and clean way to do this, but in fact it is not, because it is processing too long on data, I do not think it's an online app yet May be ready for.

This was the code that I came so far:

  function cmp ($ a, $ b) {if ($ a ["like"] == $ B ["likes"]) {return 0; } Return ($ a ["like"] & gt; $ b ["Like"])? -1 1; } {$ Fql = 'Select where in the user (Choose friend where UID1 ='. $ Uid. ') And has_added_app = 1'; $ _friends = $ facebook- & gt; API (array ('method' = & gt; 'fql.query', 'query' = & gt; $ fql)); } Hold (FacebookApiException $ e) {print_r ($ e); Error_log ($ E & gt; GetType ()); } // The FQL request is returned to a new array of user IDs. $ Likes = array (); If (is_array ($ _ friends) & amp; amp; amp; count ($ _friends)> 0) {foreach (friends as friend) {$ fid = $ friend ["uid"]; Try {$ fql = 'SELECT url FROM url_like WHERE user_id =' $ Fid 'And strokes (short (url), "tooogusto") & gt; = 0 '; $ _likes = $ facebook- & gt; API (array ('method' = & gt; 'fql.query', 'query' = & gt; $ fql)); $ Preference [] = array ("uid" => gt; $ fid, "like" = & gt; count ($ _ likes)); } Hold (FacebookApiException $ e) {$ Preference [=] = Array ("UID" => gt; $ fid, "like" => 1); to continue; Error_log ($ E & gt; GetType ()); }}} Usort ($ preference, "CMP"); Print_r ($ preference);   

I have a lot of questions, and of course you can help me as if I am a beautiful newbie.

Can someone please help me in coding without this fax?

  • List of my friends
  • Number of posts that only
  • some APIIID

    your Thanks a lot for help.

    FQL is not a problem. The fact is that you are calling FQL in a foreach loop

    If you are calling this function in another foreach loop, So forget about it

    Try making a call with a FQ polygon.

      $ queries ['my_friends'] = 'Where the user is in the user (select friend where UID1 = I ()) and hedaid_appe = 1'; $ Queries ['liked_url'] = 'SELECT url, url_like from user_id, where WHERE user_id IN (SELECT uid FROM # my_friends) and strokes (less url, "muchogusto") & gt; = 0 '; $ Multiquery = json_encode ($ queries); $ Result = $ Facebook-> API (array ('method' = & gt; 'fql.multiquery', 'queries' => $ multiquery);    

  • No comments:

    Post a Comment