Sign In | Site Map
Toggle Networks
Home Solutions Corporate Support Contact Us
corel draw kaufen prix adobe indesign cs4 acheter microsoft excel acheter word 2003 windows vista vollversion downloaden omnipage preis windows vista ultimate kaufen acheter dreamweaver 8 acheter office 2010 mac microsoft windows 7 ultimate preis autocad günstig autocad 2010 download deutsch powerpoint preis sql server preisliste prix windows xp pro dreamweaver download deutsch windows 7 home premium telecharger preis matlab lizenz achat windows 7 integrale prix norton 360 microsoft office enterprise 2007 kaufen prix windows 7 entreprise acheter windows vista professionnel prix de photoshop pour mac microsoft office download deutsch illustrator cs4 preis windows xp kaufen preisvergleich acheter adobe photoshop cs2 adobe cs5 master collection preis telecharger photoshop fr acheter windows 7 pack famille microsoft windows 7 günstig prix flash cs4 acheter kaspersky internet security 2009 cubase acheter adobe photoshop cs4 francais outlook vollversion download achat microsoft office 2009 prix office 2007 oem prix autocad lt acheter microsoft word powerpoint 2003 download deutsch windows 7 professional günstiger achat windows 2008 server solidworks prix licence illustrator prix windows vista preisliste adobe after effects cs4 preis microsoft word 2003 kaufen windows vista ultimate prix prix windows 7 integrale visio microsoft prix windows 7 starter download deutsch prix de photoshop office 2007 etudiant et famille dragon naturally speaking 10 preis kaspersky internet security 2010 pas cher windows vista home premium preis visual studio 2008 preise windows 7 premium preisvergleich autocad 2009 download deutsch acheter microsoft project 2003 adobe premiere preis telecharger autocad francais achat solidworks 2010 adobe indesign prix windows 7 kaufen preis lightroom achat windows 7 prix etudiant acrobat preis acheter autocad 2008 microsoft project preise windows 7 preis home premium cubase sx3 kaufen acheter encarta 2010 excel 2007 kaufen pcanywhere prix office 2003 billig windows 7 professional kauf cubase vollversion download illustrator vollversion guitar pro 5 preis windows 7 ultimate oem fr pinnacle studio 14 prix office 2007 pme download sony vegas pro 9 kaufen flash cs4 telecharger acheter adobe premiere cs4 dreamweaver cs4 prix archicad 13 prix adobe cs4 master collection preisvergleich prix de windows 7 en suisse preis cs4 preis microsoft office windows xp preis acheter photoshop corel draw preisvergleich preis nero 8 autocad 2010 telechargement acheter sql server 2008 powerpoint acheter achat photoshop elements 7 acheter office 2007 cubase sx3 prix windows 2003 kaufen achat microsoft autoroute 2010 adobe lightroom 2 preisvergleich kaufen outlook 2003 corel draw x4 kaufen windows 7 preiserhöhung 2010 windows vista 64 bits fr adobe indesign cs3 download deutsch prix autocad architecture 2009 acheter windows seven ultimate achat windows vista home premium prix de solidworks 2010 microsoft word vollversion photoshop cs5 preis kaspersky pas cher windows 7 billiger für studenten windows 7 pro kaufen prix windows 2008 adobe photoshop cs4 günstig windows 2008 datacenter preis prix adobe creative suite 4 master collection adobe audition 3 preis acheter acrobat distiller acheter windows 2000 pro achat office 2007 pro windows vista business kaufen windows 7 prix auchan word 2007 prix telecharger photoshop cs4 adobe indesign cs4 preis adobe photoshop elements 8 preise flash cs4 preis acheter windows xp sp1 corel draw pas cher telecharger windows 7 final microsoft outlook 2007 vollversion acheter microsoft office 2003 preis 3ds max prix office 2010 dreamweaver cs3 preis preis office 2010 prix de guitar pro adobe illustrator telechargementz pcanywhere download deutsch adobe illustrator cs2 kaufen windows 7 professional vollversion 64 bit windows 7 preisvergleich heise final cut express 4 kaufen acheter windows 7 fnac microsoft visio 2007 kaufen preis windows 7 family pack telecharger dreamweaver cs5 prix windows seven indesign preisvergleich preis autocad mechanical acheter windows 7 64 bits windows xp kauf preis office 2007 achat sony vegas 9 prix windows 7 en belgique prix de autocad 2010 acheter photoshop cs mathcad kaufen microsoft works vollversion autosketch preise windows 7 starter prix preis outlook express adobe cs3 design premium vollversion prix adobe after effects cs5 vmware workstation preisvergleich telecharger windows vista windows 7 professional preis oem prix autodesk maya sql server 2008 prix photoshop elements 6 prix telecharger windows 7 ultimate 32 bits kaspersky internet security 2010 billig acheter cubase 5 prix de office 2003 windows 7 professional preis media markt windows 7 ultimate vollversion windows xp telechargementz acheter adobe after effects telecharger microsoft office frontpage 2003 nero günstig windows 7 home premium vollversion download lightroom prix telecharger microsoft office 2007 francais adobe cs5 francais dreamweaver preis vmware workstation 7 preisvergleich adobe elements 8 preis prix quarkxpress 8 prix office 2008 mac cubase 5 preisvergleich frontpage vollversion prix autocad light adobe premiere pro cs4 download deutsch adobe indesign cs3 kaufen office 2007 günstig telecharger adobe premiere pro cs5 outlook acheter solidworks preisvergleich windows 7 billiger kaufen acheter vmware workstation microsoft outlook 2007 günstig windows 7 günstiger kaufen word 2007 kaufen sony vegas pro 9 preis prix sony vegas pro 9 prix microsoft outlook acheter norton ghost preis solidworks prix de windows vista acheter ms money 2005 quarkxpress 8 kaufen acheter windows 7 edition familiale premium adobe premiere prix premiere elements preis windows 7 kaufen schweiz adobe premiere elements 8 prix prix microsoft access prix office 2007 standard microsoft office 2007 vollversion kaufen acheter windows 7 oem word 2003 download deutsch windows xp download deutsch windows 7 vollversion oder upgrade windows 7 home preise photoshop elements preisvergleich adobe photoshop cs3 prix telecharger adobe photoshop francais acheter windows xp edition familiale acheter adobe cs5 master collection adobe fireworks preis preis adobe lightroom acheter outlook 2010 preise photoshop cs3 acheter adobe cs3 prix 3ds max 2010 acheter visual studio 2008 acheter indesign cs3 autodesk inventor download deutsch preis autocad architecture 2010 achat 3ds max 2010 acheter access 2007 windows xp professional sp3 kaufen prix dragon naturally speaking 10 achat windows xp pro sp3 prix windows xp sp3 kaspersky internet security 2010 vollversion adobe cs4 acheter adobe acrobat prix final cut express preisvergleich acheter dreamweaver cs3 nero 9 vollversion deutsch prix adobe photoshop 7.0 acheter pinnacle 12 norton ghost 15 preis acheter windows 7 telechargement prix autocad electrical preise indesign acheter autodesk inventor achat windows 7 professionnel acheter final cut express 4 acheter adobe audition 3.0 illustrator cs3 kaufen acheter windows 7 carrefour office 2007 etudiant prix acheter adobe after effect cs4 achat windows xp version boite acheter pinnacle studio 12 ultimate acheter windows 7 ultimate oem acheter photoshop illustrator preis dreamweaver cs5 office 2007 pro prix acheter windows 7 integrale windows 7 x64 french acheter autocad 2009 office 2003 kaufen prix windows 7 64 prix windows vista home premium achat acrobat 9 prix matlab windows seven prix oem preis office 2003 windows 7 preis oem office 2007 preisvergleich microsoft money download deutsch adobe photoshop cs4 vollversion download windows 7 pro vollversion windows 7 ultimate günstiger prix adobe illustrator cs4 acheter omnipage acheter windows xp oem photoshop prix cs4 adobe dreamweaver cs4 vollversion windows 7 preiswert acheter cubase 4 acheter adobe premiere pro cs3 prix windows 7 pro prix de windows 7 francais windows 7 ultimate vollversion kaufen telecharger cubase francais microsoft access preis acheter windows 7 canada prix windows xp 64 bits windows 7 preis geizhals dreamweaver telecharger autodesk maya kaufen telecharger adobe design prix visual studio 2005 pinnacle studio 14 kaufen acheter vista basic sql server 2008 preisliste photoshop cs4 download deutsch acheter outlook 2003 adobe captivate 3 download windows xp pro preisvergleich prix de powerpoint windows 7 pas cher illustrator cs5 kaufen indesign cs5 vollversion 3ds max 2010 kaufen prix cs4 premium microsoft office 2010 preise achat adobe photoshop elements 8 vollversion powerpoint acheter photoshop cs5 extended telecharger windows xp pro french acheter windows 7 pro microsoft office prix étudiant maya preis autocad 2010 vollversion preis windows 7 pro preise lizenz autocad preis adobe photoshop cs3 preis autodesk inventor professional kaufen prix adobe illustrator cs3 inventor download deutsch telecharger windows vista pro prix adobe acrobat pro 9 office 2010 kaufen microsoft windows 7 kaufen windows 7 premium kaufen windows seven preisvergleich archicad 13 preisliste

Facebook Applications - A how to guide

July 22nd, 2008 by Lee Babin
No Gravatar

The iPhone has recently opened up its application development platform, making it the most recent joiner in a massive campaign of user submitted content for different platforms.  While platforms such as iPhone, Bebo, Myspace, Friendster, etc. have moved to this model, the Facebook development platform was something of a pioneer for this concept.  Nearly a year has gone by since Facebook opened up its platform for live development and they have taken the time to develop a fairly robust platform and have had some very successful applications setup shop in their directory.

With all of the hype (and venture capital) being thrown around to promote the service, developers around the world have begun to flock to Facebook to show off their application building skills.  With a year under its belt, the Facebook platform has become pretty simple to develop for.  In this article I will go over a developer’s view on how to get an application setup and running.  In subsequent articles, I will elaborate on some of the cooler features of building and maintaining (not to mention marketing) a Facebook application.

What are we building?

A colleague came to me and asked if there was a way we could somehow post our blog entries to our Toggle Networks Facebook page.  With that in mind, for this example Facebook application, I am going to build a simple RSS feed reader to do just that.  I will then walk through (in a later post) how to integrate said application into our Toggle Networks Facebook page.

Step 1 - Install the Developer Application

In a smart move to get people familiar with the application install process, Facebook has made it’s management tool for its platform an application itself.  The first thing you need to do to get started is install the Developer application.  Login to Facebook and proceed to this link:

http://www.facebook.com/developers

Step 2 - Create a New Application

Once you have the developer application installed to your Facebook account, it will appear as a link on the left hand navigation bar of Facebook beside all of your other applications.  Click it to go to the Developer application.

Next, click the “Set Up New Application” button at the top of the Developer application.  You will be given a box to fill out so that you can name your application.  In this case, since we are building an RSS feed reader, I will call our application “Toggle RSS Feed Reader”.  Deal with the terms and decide if you want to accept them by checking the box.  Now, drop down the optional fields information.

Now, you will be presented with a list of new options.  A few of them are very important.  Enter your email preferences, then have a look at the Callback URL field.  This field will dictate where you are going to place the code for your application.  Since Facebook does not actually host the code for your application, you will have to have a server setup where you will host your own code.  In my case, I am going to host my code at:

http://www.codewriter.ca/facebook/togglerss/index.php

The next order of importance is the Canvas Page URL.  As you might expect, this will be your application’s home on Facebook.  This is akin to finding a URL these days, you may have to get creative.  I am going to use togglerss so my official Facebook application URL would then be http://apps.facebook.com/togglerss .  You will then have to choose whether you want an iFrame application or an FBML application.  There are benefits / issues with both solutions.  I look at it this way.  If you never plan to leave the Facebook platform (IE: you will never port this application to a new platform or website), then choose FBML.  FBML provides some very easy ways to perform functionality (such as friend invites) and ensures your applications will stick to the Facebook aesthetic.  It is also much easier to develop for.  However, if you want ultimate flexibility, choose the iFrame option as it will allow you to completely control your application and make it look however you want.  You will have access to Facebook API with whichever option you choose so the choice is ultimately yours.

If you wish to have the classic setup for Facebook applications, choose “Desktop” as your application type, a list of new options should now appear.  The most important of these is the question “Can your application be added on Facebook”.  Since I don’t mind if someone wants to add the Toggle feed, I will select “Yes” for this option.  Once you click this option, a whole slew of new options will become available.

I am not going to go over most of these options now as they are merely ways to extend your application and are not required to get moving.  I will however note that you should dictate who can add your application as this will become very important should anyone try to add it.  In this case I have chosen “Users” and “All Pages”.  You may want to check the “Developer Mode” box to on while you develop so that no one adds your application before it is ready.

If you have done everything correctly, you should now see something like the screen above.  Note that I have blacked out my api key and secret key.  As the names suggest, you should keep these private, you will make use of them in your code.

Step 3 - Let’s Get Coding!

If you were to go to my Facebook application URL at this point, you would see the above screenshot.  This is because I have not put any code yet to where my callback URL will resolve.  In other words, I need to actually develop this application at this point so that the callback URL can resolve.  Facebook makes it easy for you to develop in whatever language you are comfortable with.  Facebook even provides libraries and such for getting started.  Since I am a PHP guy and Facebook has a highly usable PHP client library, I recommend you go ahead and download that one.  Here is the link:

http://developer.facebook.com/resources.php

Once you have the platform downloaded, create a new file.  In my case, I am naming it index.php.  Include in the facebook.php file into your index.php file and then upload all files (facebook.php, facebookapi_php5_restlib.php and index.php) to your server and you will have the bare minimum to get your URL resolving.  Your code should look something like this:

<?php
require_once (”facebook.php”);
?>

Now, we need to get the base information in so that Facebook knows whose application this is and get some authentication in place.  I like to break my configuration options out into a separate file so I created a file called config.php.  In this config.php file, you need to specify your api key and secret code (that were dictated to you when you first created your application).  To view them, you can simply click on the Developer application and then click on see “My Apps”.  My config file looks like this:

<?php
$apikey = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”;
$secret = “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”;
?>

Now, to make use of the Facebook API, you must create an instance of the Facebook class.  Then, you can call the require_login method to obtain the user id of the current user and force them to install your application if they wish to use it.  The following code now takes up my index.php file:

<?php
require_once (”config.php”);
require_once (”facebook.php”);

$facebook = new Facebook ($apikey,$secret);
$user = $facebook->require_login();
?>
<fb:mediaheader uid=”<?=$user?>”></fb:mediaheader>

If you navigate to your application now, it will ask you to install it.  Do so.

Next, we need to actually display something.  Since I am using FBML for this particular application, this part will be easy.  FBML provides a ton of little code widgets you can use to build your application very rapidly.  A full listing of them can be found on Facebook’s developer wiki here:

http://wiki.developers.facebook.com/index.php/FBML

I have decided to put in a “Media Header” which puts a nice little header in at the top, feel free to experiment and put in what you would like.  Now, you simply need to put in whatever code you desire.  In this case, I created a class called rssReader, the code for which you can download here:

Then, with the code downloaded, you can simply instantiate the class and call the showFeed() method to achieve the following results.

Conclusion

The previous article has brought you through how to create a basic Facebook application.  In future articles, I will start detailing some of the cooler Facebook specific functionality starting with how to integrate a Facebook application into a Facebook page.

Tags: , ,

2 Responses to “Facebook Applications - A how to guide”

  1. Jae ChantlerNo Gravatar Says:

    Thank you for opening up the world of blogging to our Toggle team. I never imagined it would be this awesome. Oh, what else could Lee have for us? I do think it is about time for a little Dance, Dance Revolution.

  2. Lee BabinNo Gravatar Says:

    It is very long past time for Dance Dance revolution. Never has something been so specifically designed to be humorous!

Leave a Reply