tags:

views:

258

answers:

1

My requirement was to update members status from my site, i am also thinking about displaying their friends photos and their last status update.

I have looked all over the docs and cant decide which works for my need. RESTful API, JavaScript API, FQL, XFBML, FBML, FBJS ?? whcin one works best? or best way?

It should be like, when they first go to the page,there will be nothing but a login option. when they click on it, a pop up should appear and when they are authorized, we display a text area to post update. Here, i wanted to show their friends pics too

when they came back later, they should able to post right away, must not ask for login again.

Can some one help me with the code?? I dont expect you to write everything, get the friends pic and their last update into a PHP array would be nice.

Many thanks

+1  A: 

If u need to update users data stored at ur database so u will use the facebook API to check user signed in and get his data. i have an ifram application at facebook and i am using C# code (asp.net application) and when the user request the application i authenticate that he is signed in to facebook and check if he is already exist in my database? if not so i get his information(by using facebook API) and add the user in my data base and each time he visits the application i update his information.

With respect to his friends i get all facebook ids of the user friends and then loop these IDs and get the pic of each ID. Download Facebook Developer Toolkit that enables u communicate with facebook and use facebook API to get user information.

hope that is will help u

Visit my application in facebook and u will see these features at the following link : http://apps.facebook.com/hanggame/

Getting the session Key :

 protected void Page_Load(object sender, EventArgs e)
    {
        //Facebook code for integration with facebook users:
        _fbService.ApplicationKey = "Application Key";
        _fbService.Secret = "Secret Key";
        _fbService.IsDesktopApplication = false;
        string sessionKey = (string)Session["Facebook_session_key"];
        if (Session["Facebook_userId"] != null)
            userId = (long)Session["Facebook_userId"];

    // When the user uses the Facebook login page, the redirect back here will will have the auth_token in the query params
    string authToken = Request.QueryString["auth_token"];
    if (!String.IsNullOrEmpty(sessionKey))
    {
        _fbService.SessionKey = sessionKey;
        _fbService.uid = userId;
    }
    else if (!String.IsNullOrEmpty(authToken))
    {
        _fbService.CreateSession(authToken);
        Session["Facebook_session_key"] = _fbService.SessionKey;
        Session["Facebook_userId"] = _fbService.uid;
        Session["Facebook_session_expires"] = _fbService.SessionExpires;
    }
    else
    {
        Response.Redirect(@"http://www.Facebook.com/login.php?api_key=" + _fbService.ApplicationKey + @"&v=1.0");
    }
    userId = _fbService.uid;
    //End of Facebook code    
}
Ahmy
thanks but how do you save his info., how do i get the infinite session key?
chris
Look at the response after editting it will include how i got the session key
Ahmy
Awesome! Is there a PHP version of this code?
chris

related questions