Title: Facebook Application Development
1- Facebook Application Development
2Creating A Facebook Application
The first step in creating a Facebook application
is to Add the Developer application and apply
for an API key.
3applications Edit Settings
- Application Name
- Callback Url (http//fb.terralever.com/default.as
px) - After the user installs your application, they
will be redirected to this URL with an
authentication token. - Canvas Page URL (http//apps.facebook.com/appname
/) - Use FBML or iframe
- Developers (Developers Mode)
- Default FBML
- Side Nav URL
4Anatomy of a Facebook application
lt?php include_once 'facebook.php' api_key
'394759e4eed094bd5ecff8a30fb9d276' secret
'415a8724657f40a47ab96b2babe07e7a' facebook
new Facebook(api_key, secret) user
facebook-gtrequire_login() //require that the
app be installed prior to displaying canvas
page if (!facebook-gtapi_client-gtusers_isAppAdded(
)) facebook-gtredirect(facebook-gtget_add_ur
l()) //set the fbml logo_sm 'ltimg
srchttp//www.safeandsustainable.com/logo_sm.jpg
gt' name 'ltfbname uid"'.user.'"
firstnameonly"true" useyou "false"/gt' fbml
'ltfbnarrowgt' . name . ' this is narrowltbr/gt'.
logo_sm . 'lt/fbnarrowgt' fbml . 'ltfbwidegt' .
name . ' this is wideltbr/gt'. logo_sm .
'lt/fbwidegt' facebook-gtapi_client-gtprofile_setFB
ML(fbml, user) //return the canvas view logo
'ltimg src"http//www.safeandsustainable.com/log
o.jpg"gt' echo 'ltdiv style"margin20px"gt'.logo.
'lt/divgt' ?gt
5Application Installation
lt?php include_once 'facebook.php' api_key
'394759e4eed094bd5ecff8a30fb9d276' secret
'415a8724657f40a47ab96b2babe07e7a' facebook
new Facebook(api_key, secret) user
facebook-gtrequire_login() //require that the
app be installed prior to //displaying canvas
page if (!facebook-gtapi_client-gtusers_isAppAdded(
)) facebook-gtredirect(facebook-gtget_add_ur
l())
6Facebook Profile View
7Facebook Profile View - Code
lt?php . //set the fbml logo_sm 'ltimg
src"http//www.safeandsustainable.com/logo_sm.jpg
"gt' name 'ltfbname uid"'.user.'"
firstnameonly"true" useyou "false"/gt' fbml
'ltfbnarrowgt' . name . ' this is narrowltbr/gt'.
logo_sm . 'lt/fbnarrowgt' fbml . 'ltfbwidegt' .
name . ' this is wideltbr/gt'. logo_sm .
'lt/fbwidegt' facebook-gtapi_client-gtprofile_setFB
ML(fbml, user) . ?gt
8Facebook Canvas View
lt?php . //return the canvas view logo 'ltimg
src"http//www.safeandsustainable.com/logo.jpg"gt'
echo 'ltdiv style"margin20px"gt'.logo.'lt/divgt'
. ?gt