how to show facebook friends status



facebook status api is still in beta, in one of previous posts hasin showed how to set status of users with their permission. now, let’s see how we can get our facebook friend’s status, in next step i will show a tricky way to get a random person’s status who is not your facebook friend.

first let’s see how we can show our friends status. these following lines of code will return us an array


include_once("config.php");
//i'm using my own id
$user_status= $facebook->api_client->fql_query("SELECT status FROM user WHERE uid =579152077");
echo "<pre>";
print_r($user_status);
echo "</pre>";
//this will return an array like following
Array
(
    [0] => Array
        (
            [status] => Array
                (
                    [message] => is testing facebook status api.
                    [time] => 1234464510
                    [status_id] => 53699066735
                )

        )

)

so we can get any of our facebook friends’ status like this. If no status messages are found, the method returns an empty status_get_response element. now, the thing is, we can check our friends status from “live feed” tab on our home page right? so this status api could be interesting if we can show random friend’s status eh? unfortunately, this current beta API doesn’t support to get any random friends status but for the time being there is a possible way to get status of a person who is not our facebook friends BUT if he/she has at least 1 mutual friend. so let’s find a least possible way to get a random friend’s status who is NOT our friend on facebook but has a mutual friend. don’t worry, you don’t have to know his or her id :) let’s have a look at following code.


include_once("config.php");
//get id by the random person's full name
$user_details = $facebook->api_client->fql_query("SELECT uid FROM user WHERE name = 'your_random_friend_full_name'");
//if this full name is unique and has a mutual friend with you, you can get his/her id like this...
$user_details[0]['uid'];
//now let's find out the status of that person
$status_array= $facebook->api_client->fql_query("SELECT status FROM user WHERE uid = {$user_details[0]['uid']}");
//now, simply it will return an array with status message like before.

I know this is not the right way to get status. i strongly believe facebook should open this status access to random friends with email id or full name – only then we can expect lot’s of cool application on facebook based on this status api.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • blinkbits
  • BlinkList
  • Blogosphere News
  • description
  • E-mail this story to a friend!
  • Furl
  • Gwar
  • LinkedIn
  • Ma.gnolia
  • MySpace
  • Ping.fm
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • TwitThis
  • Upnews

15 Responses to “how to show facebook friends status”

  1. Raquibul Islam  on February 13th, 2009

    nice . thanks for share :)

  2. rc29  on February 13th, 2009

    hi, there’s also an easy way to show the status of a user:

    <fb:user-status uid=”" linked=”true”/>

    Bye

  3. rc29  on February 13th, 2009

    ay! i can’t write php code in comments…

  4. rc29  on February 13th, 2009

    hey ! that sucks ! how can i do to write proper code in the comments ?

    so………. to show the status of user:

    (@Junal: sorry for triple post ! ;) )

  5. peter  on February 25th, 2009

    BTW, thanks in advance for any help :)

  6. Nidhi vats  on May 21st, 2009

    this site is very useful site

  7. mansukh mangukiya  on June 27th, 2009

    facebook is useful to find a good friends.

  8. mansukh mangukiya  on June 27th, 2009

    facebook is useful to find a good friend.

  9. VAISHNAVI  on August 2nd, 2009

    HAPPY FRIENDSHIP DAY

  10. blogbiss  on September 7th, 2009

    nice post, it needs permission from our friends

  11. DefZelilijild  on April 20th, 2010

    comment4, propecia side effects forum, diminished, cheap vicodin, 571, next day viagra, regrets, buy viagra cialis, 4026, phentermine mexico, thong, how much cialis, X-D, women and viagra, wrestling, generic viagra uk, 9914, viagra prescription cost, 7076, valium 2, :-]

  12. Ceargeast  on May 27th, 2010

    comment2, zithromax dose, 9222, low dose prednisone, 7305, viagra generic online, derived, buy ambien cr, 2994, levitra medication, capture, antibiotic zithromax, startlingly, pfizer viagra online, suited, cialis in holland, militia, viagra for men, spat, viagra low cost, heartily

Leave a Reply