ColdFusion

From Facebook Developer Wiki

Jump to: navigation, search

Contents

[edit] Starter guides and code

For use with the NEW Facebook

The demo builds off the works of Dominic Watson and Andrew Duckett

Build an application in 8 minutes here: http://cffacebook.wordpress.com/8-minute-apps/

Download: http://cffacebook.riaforge.org/

For use with FBML

  • Dominic Watson has created a starter template specifically for users wanting to use FBML. You can download it from RiaForge here: http://fbmlstarter.riaforge.org/

For use with iFrames

[edit] Other How To's

[edit] Common Problems

There is a problem with the post fields Facebook sends and CFMX automated form validation which is documented here: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:52048

Previous fixes worked for CF7 but have subsequently been broken again by CF8. An all encompassing, and far more efficient, method was offered by Anthony Webb:

In application.cfm/cfc, after using form.FB_SIG to authenticate the Facebook post request, simply do:

<cfset form.FB_SIG = "">

Alternatively, do:

<cfset form.FB_SIG_X = form.FB_SIG>
<cfset form.FB_SIG = "">

Then use form.FB_SIG_X to authenticate the post request.

Note: Dominic Watson's FBML starter template incorporates this fix.


In FacebookRestClient.cfc, the fbml_setFBML function needs another parameter to work with the new profile since the Wall page box and the Boxes box have different API names now and the "markup" paramter is being deprecated. The parameter "profile_main" sets FBML for the Wall box, and "profile" sets FBML for the Boxes box.

     <cffunction name="fbml_setFBML" access="public" output="false" returntype="any">
     <cfargument name="fbml" type="string" required="yes" />
     <cfargument name="fbml_main" type="string" required="yes" />
     <cfargument name="sess_key" type="string" required="yes" />
     <cfset var result = "" />
     <cfset var params = StructNew() />
     <cfset params["profile"] = arguments.fbml/>
     <cfset params["profile_main"] = arguments.fbml_main/>
     <cfset params["session_key"] = arguments.sess_key/>
     <cfset result = callMethod("facebook.profile.setFBML", params) />
     <cfreturn result />
     </cffunction>

[edit] Rolling Your Own REST Interface

If you are going to develop our own REST interface, you must make sure to convert your MD5 hash created by ColdFusion to lower case. By default hash() creates an MD5 hash in all UPPER CASE which will cause the FB API to reject your SIG!

Ensure your HASH is lowercase:

<cfset sig = lcase(hash(argumentString))>
reference