ToDo and Not ToDo when developing facebook application


Below tips for those who develop iframe base facebook application or facebook connect base application.

Tips # 1

Avoid facebook api call as much as possible.

$fbme     =   $facebook->api('/me');

Save api result that you will frequently use in memcache or php session

session_start();
$fbme     =   $facebook->api('/me');
$_SESSION['fb_user_data'] = $fbme;

Tips # 2

Check this tutorial to increase the authentication performance of your application

Tips # 3

Write facebook viral feature related codes in once place, better in a class. And call the functions of that class in various place of your project where its needed.

Tips # 4

Load Javascript SDK along with php-sdk in web application so that you could easily parse XFBML tags and do other tasks like showing wallpost dialog easily.

Tips # 5

Use FQL Multiquery REST API method instead of FQL Query method so that you could easily pick a bunch of FQL query in a single api call.

Tips # 6

Retrieve user’s facebook friends once and save them in the current session to avoid facebook api call each time.

session_start();
$friends    =   $facebook->api('/me/friends');
$_SESSION['fb_user_friends'] = $friends;

Tips # 7

Use Graph api if possible instead of REST Api because facebook called REST Api as Old api. So who knows when they will call them legacy and will deprecate :S

Tips # 8

By time facebook limited their viral features. So don’t forget to use facebook’s 3 viral features now:

  • Invitation feature
  • Wall post publishing feature
  • Email send feature

Tips # 9

Keep your eye open to facebook’s real time update. Facebook announce their platform activities here. So you’ll know earlier what changes will appear soon in the facebook platform.

Tips # 10

Checkout facebook official documention for any kind of reference related to their platform.

mahmud ahsan

Love computer programming and write occasional blog post. In my early career I worked mostly on web based application and since 2011, I exclusively working on iPhone and android applications. I work at home, father of a nice kid and husband of a beautiful wife. [My Business | Twitter | Linkedin]

You may also like

13 Comments

  • Uugan
    October 8, 2010 at 3:59 pm

    I did like below

    There was no problem on index.php page. But I have a several pages that serves me some real time info via ajax (time, money, cash etc) which are exist in other sub folder on my server… If I open browser (IE 7.0 and 8.0) newly my real time info comes with undefined or null, but if I refresh IE with F5 key and Refresh button everything goes fine again… What is the problem??? I have also tested with Mozilla, and IE 6.0 everything was ok… Also sorry for my bad English.
    Regards Uuganaa

  • Uugan
    October 8, 2010 at 4:00 pm

    Something missed…

  • Luqman
    October 15, 2010 at 11:08 pm

    Hi, Thanks for the hard work for other developers and thanks for sharing your experience. I have a issue with graph api hope some one will help me. I need to use old facebook api function dashboard_publishactivity. Actually i need to publish activity on logged in users facebook recent activities using facebook connect+graph api.
    Is it possible? Thanks.

  • Slawek
    October 28, 2010 at 2:52 am

    Hello. I see that you have great experience. I have a question: do you know how publish to fan page wall with facebook graph api? Thanks

  • hadadjus
    November 5, 2010 at 5:55 pm

    please how can ‘i use it on xfbml , iframe application without php

    • mahmud ahsan
      mahmud ahsan
      November 6, 2010 at 3:57 pm

      you have to use javascript connect sdk by facebook, so that the javascript code parse the xfbml correctly.

  • Mubarak Zeb
    December 6, 2010 at 8:46 am

    FBML is also deprecated now, I think we should stick to developing apps in iFrame. Thanks

    • mahmud ahsan
      mahmud ahsan
      December 7, 2010 at 4:07 pm

      Yeah we should use iframe now, this article is old 🙂

  • Ina Franks
    December 24, 2010 at 5:04 am

    FBML is also deprecated now, I think we should stick to developing apps in iFrame. Thanks

  • DD
    May 1, 2011 at 10:09 pm

    You have some good info. What is this about FBML is also deprecated now? Should I stop using it?

    • mahmud ahsan
      mahmud ahsan
      May 2, 2011 at 1:09 am

      Yeap forget about fbml and develop iframe base application.

  • sanjay
    June 6, 2011 at 3:45 pm

    hello,

    i have acess userdata without using json …would u guide me on what way ….can i do this…

    thanks in advance.

Comments are closed here.

About Me

Hi I am Mahmud Ahsan. I Love computer programming and write occasional blog post. In my early career I worked mostly on web based application and since 2011, I exclusively working on iPhone and android applications. I work at home, father of a nice kid and husband of a beautiful wife. [My Business | Twitter | Linkedin]

Twitter Feed

Fanpage