<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Facebook Cookbook &#187; offline</title>
	<atom:link href="http://fbcookbook.ofhas.in/tag/offline/feed/" rel="self" type="application/rss+xml" />
	<link>http://fbcookbook.ofhas.in</link>
	<description>thousands of app development recipes</description>
	<lastBuildDate>Sun, 21 Mar 2010 10:38:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>how to successfully update all of your user&#8217;s profile offline, at once! &#8211; part 1</title>
		<link>http://fbcookbook.ofhas.in/2009/02/03/how-to-successfully-update-all-of-your-users-profile-at-once-part-1/</link>
		<comments>http://fbcookbook.ofhas.in/2009/02/03/how-to-successfully-update-all-of-your-users-profile-at-once-part-1/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 15:05:43 +0000</pubDate>
		<dc:creator>Hasin Hayder</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[FBML]]></category>
		<category><![CDATA[Profile]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[offline]]></category>

		<guid isPermaLink="false">http://fbcookbook.ofhas.in/?p=47</guid>
		<description><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/03/how-to-successfully-update-all-of-your-users-profile-at-once-part-1/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to successfully update all of your user&#8217;s profile offline, at once! &#8211; part 1';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
sounds crazy right? but actually you can make a great use of this feature in your facebook application. lets think that your application is kind of a todo-list or birthday reminder. now your users will create tasks or added friend to be notified when their birthdays arrive, or when the eta of a task is [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/03/how-to-successfully-update-all-of-your-users-profile-at-once-part-1/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to successfully update all of your user&#8217;s profile offline, at once! &#8211; part 1';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<p>sounds crazy right? but actually you can make a great use of this feature in your facebook application. lets think that your application is kind of a todo-list or birthday reminder. now your users will create tasks or added friend to be notified when their birthdays arrive, or when the eta of a task is in 24 hours. in these cases you may have to update those user&#8217;s profile in background so that when they visit their profile page &#8211; they will see the latest information, and that will be very useful for them. </p>
<p>there are two ways to accomplish this task</p>
<p>1. by calling setFBML offline, using any of user&#8217;s session key.<br />
2. by using &lt;fb:ref /> with an url handler, which is a smart way indeed. </p>
<p>in this article i am going to focus on first technique. next article will focus on 2nd one. </p>
<p><b>updating using profile_setFBML()</b><br />
to use this api offline, you first need a session key. the following code will print the session key for you. </p>
<pre name="code" class="php">

&lt;?php
echo $facebook-&gt;api_client-&gt;session_key;
?&gt;
</pre>
<p>this code will output something like &#8220;<em>6de106fa7e2de0820b091f12-503274632</em>&#8221; which is my session key for this application. </p>
<p>now you can update all of your user&#8217;s profile using the following code. please note that i have used batch api for the sake of performance. </p>
<pre name="code" class="php">

&lt;?php
require_once &#039;client/facebook.php&#039;;

$appapikey = &#039;ff0b3d87fc42915533e15dc238f2d447&#039;;
$appsecret = &#039;app_secret_key&#039;;
$sessionkey = &quot;6de106fa7e2de0820b091f12-503274632&quot;;
$facebook = new Facebook($appapikey, $appsecret);

$uid1 = 657561905;
$uid2 = 503274632;

$facebook-&gt;api_client-&gt;user = $uid2;
$facebook-&gt;api_client-&gt;session_key = $sessionkey;

$facebook-&gt;api_client-&gt;begin_batch();

$facebook-&gt;api_client-&gt;profile_setFBML(NULL, $uid1, &quot;Offline profile &lt;fb:name uid=&#039;{$uid1}&#039; useyou=&#039;false&#039; /&gt;&quot;, NULL, &#039;mobile_profile&#039;, &#039;profile_main&#039;);
$facebook-&gt;api_client-&gt;profile_setFBML(NULL, $uid2, &quot;Offline profile &lt;fb:name uid=&#039;{$uid2}&#039; useyou=&#039;false&#039; /&gt;&quot;, NULL, &#039;mobile_profile&#039;, &#039;profile_main&#039;);

$facebook-&gt;api_client-&gt;end_batch();
?&gt;
</pre>
<p>if you need to update thousands of your user&#8217;s profile at a time, using the batch api is a must or you will suffer from timeout. now you can execute this script by either command line &#8220;php &lt;script_file>.php&#8221; or by accessing it via browser <img src='http://fbcookbook.ofhas.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>pretty neat, eh?</p>
<p>stay tuned for next part of this article where we will tell you how to update profile data offline using &lt;fb:ref /> with an url handler <img src='http://fbcookbook.ofhas.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://fbcookbook.ofhas.in/2009/02/03/how-to-successfully-update-all-of-your-users-profile-at-once-part-1/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
