<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Dragonfly RIA Blog - facebook</title>
			<link>http://www.dragonflybytes.com/blogger/index.cfm</link>
			<description>Dragonfly RIA Blog</description>
			<language>en-us</language>
			<pubDate>Wed, 08 Sep 2010 04:17:08 -0700</pubDate>
			<lastBuildDate>Sun, 15 Jul 2007 10:02:00 -0700</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>cory@dragonflybytes.com</managingEditor>
			<webMaster>cory@dragonflybytes.com</webMaster>
			
			
			
			
			
			<item>
				<title>Updating Facebook Profile FBML using setRefHandle, fb:ref  and &quot;infinate sessions&quot;.</title>
				<link>http://www.dragonflybytes.com/blogger/index.cfm/2007/7/15/Updating-Facebook-Profile-FBML-using-setRefHandle-and-infinate-sessions</link>
				<description>
				
				Setting up an infinate session in CF is not difficult.

You need to echo the request.session_info.session_key to the screen and save it (somewhere). You also need a user id. 

I have a scheduled task that triggers a file every hour, on the hour. 

I like the setRefHandle because it allows me to update a cache on the facebook server instead of pulling or pushing content whenever there is an update. Even if the handle is the userID, the functionality is great!

In this examle, the handle name I have chosen is called &quot;global_message&quot; and the content is the date and time when the script was last accessed. 

&lt;code&gt;
&lt;cfscript&gt;
facebook 	= CreateObject(&quot;component&quot;,&quot;FacebookRestClient&quot;).init(argumentCollection=request.config);
request.key 			= &quot;[saved session ID]&quot;;
request.uid 			= &quot;[userID]&quot;;
&lt;/cfscript&gt;
&lt;cfoutput&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;InvalidTag http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;cfscript&gt;
		res = facebook.fbml_setRefHandle(&quot;global_message&quot;, &quot;#DateFormat(Now())# #TimeFormat(Now())#&quot;, request.key);
&lt;/cfscript&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/cfoutput&gt;

&lt;/code&gt;


The function to add to the facebook CFC is this:
&lt;code&gt;
&lt;!---
Created by Cory Johnson on June 13, 2007

For help with this, contact cory@dragonflybytes.com
---&gt;
&lt;!--- cache controls ---&gt;
	&lt;cffunction name=&quot;fbml_setRefHandle&quot; access=&quot;public&quot; output=&quot;false&quot; returntype=&quot;any&quot;&gt;
		&lt;cfargument name=&quot;app_handle&quot; type=&quot;string&quot; required=&quot;yes&quot; /&gt;
		&lt;cfargument name=&quot;fbml&quot; type=&quot;string&quot; required=&quot;yes&quot; /&gt;	
		&lt;cfargument name=&quot;sess_key&quot; type=&quot;string&quot; required=&quot;yes&quot; /&gt;		
		&lt;cfset var result = &quot;&quot; /&gt;
		&lt;cfset var params = StructNew() /&gt;
		&lt;cfset params[&quot;handle&quot;] = arguments.app_handle/&gt;
		&lt;cfset params[&quot;fbml&quot;] = arguments.fbml/&gt;
		&lt;cfset params[&quot;session_key&quot;] = arguments.sess_key/&gt;
		
		&lt;cfset result = callMethod(&quot;facebook.fbml.setRefHandle&quot;, params) /&gt;

		&lt;cfreturn result /&gt;
	&lt;/cffunction&gt;
&lt;/code&gt;


In my facebook application, I have set the default FBML to this&quot;

&lt;code&gt;
&lt;fb:ref handle=&quot;global_message&quot; /&gt;
&lt;/code&gt;
				
				</description>
						
				
				<category>facebook</category>				
				
				<pubDate>Sun, 15 Jul 2007 10:02:00 -0700</pubDate>
				<guid>http://www.dragonflybytes.com/blogger/index.cfm/2007/7/15/Updating-Facebook-Profile-FBML-using-setRefHandle-and-infinate-sessions</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Coldfusion Facebook REST API Example.</title>
				<link>http://www.dragonflybytes.com/blogger/index.cfm/2007/6/13/Coldfusion-Facebook-REST-API-Example</link>
				<description>
				
				I&apos;ve created a quick and very, very dirty example on how to create a Coldfusion application for Facebook. There is no documentation with the project, and it comes as is where is blah blah blah, no warranty, etc. Use at your own risk. 

In your facebook application, set it to use an Iframe. I have not yet figured out how to pass the auth_token through a complete FBML application.

There is a REST compatible CFC &lt;a href=&quot;http://www.nearpersonal.com/code/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;

You&apos;ll need to add these two functions somewhere to your pleasing in the CFC.


&lt;code&gt;

&lt;!---
   Created by Cory Johnson on June 13, 2007

   For help with this, contact cory@dragonflybytes.com
---&gt;

	&lt;!--- fbml ---&gt;
	&lt;cffunction name=&quot;fbml_setFBML&quot; access=&quot;public&quot; output=&quot;false&quot; returntype=&quot;any&quot;&gt;
		&lt;cfargument name=&quot;fbml&quot; type=&quot;string&quot; required=&quot;yes&quot; /&gt;
		&lt;cfargument name=&quot;sess_key&quot; type=&quot;string&quot; required=&quot;yes&quot; /&gt;

		&lt;cfset var result = &quot;&quot; /&gt;
		&lt;cfset var params = StructNew() /&gt;

		&lt;cfset params[&quot;markup&quot;] = arguments.fbml/&gt;
		&lt;cfset params[&quot;session_key&quot;] = arguments.sess_key/&gt;		

		&lt;cfset result = callMethod(&quot;facebook.profile.setFBML&quot;, params) /&gt;

		&lt;cfreturn result /&gt;
	&lt;/cffunction&gt;

	&lt;cffunction name=&quot;fbml_getFBML&quot; access=&quot;public&quot; output=&quot;false&quot; returntype=&quot;any&quot;&gt;
		&lt;cfargument name=&quot;sess_key&quot; type=&quot;string&quot; required=&quot;yes&quot; /&gt;
		&lt;cfargument name=&quot;uid&quot; type=&quot;string&quot; required=&quot;yes&quot; /&gt;

		&lt;cfset var result = &quot;&quot; /&gt;
		&lt;cfset var params = StructNew() /&gt;
		
		&lt;cfset params[&quot;uid&quot;] = arguments.uid /&gt;
		&lt;cfset params[&quot;session_key&quot;] = arguments.sess_key /&gt;
		
		&lt;cfset result = callMethod(&quot;facebook.profile.getFBML&quot;, params) /&gt;

		&lt;cfreturn result /&gt;
	&lt;/cffunction&gt;
&lt;/code&gt;

A small difference between these methods, and those in the REST Client, is that I am not using the XmlToArray function. I prefer Xpath, because it&apos;s more like working with an Object. You can change that if you really want to. 

The source I made to go with this source is &lt;a href=&quot;http://www.dragonflybytes.com/blog_example_code/cf_facebook_api_example.zip&quot; target=&quot;_top&quot;&gt;here&lt;/a&gt;
				
				</description>
						
				
				<category>facebook</category>				
				
				<pubDate>Wed, 13 Jun 2007 22:09:00 -0700</pubDate>
				<guid>http://www.dragonflybytes.com/blogger/index.cfm/2007/6/13/Coldfusion-Facebook-REST-API-Example</guid>
				
			</item>
			
		 	
			</channel></rss>