<?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>sundh.com &#187; Facebook</title>
	<atom:link href="http://www.sundh.com/blog/tag/facebook/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sundh.com/blog</link>
	<description>Technology / Wood / Electronics</description>
	<lastBuildDate>Thu, 19 Jan 2012 11:54:14 +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 add Facebook like buttons to your tab</title>
		<link>http://www.sundh.com/blog/2011/01/how-to-add-facebook-like-buttons-to-your-tab/</link>
		<comments>http://www.sundh.com/blog/2011/01/how-to-add-facebook-like-buttons-to-your-tab/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 16:06:32 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Facebook page]]></category>
		<category><![CDATA[fbml]]></category>
		<category><![CDATA[Like button]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=446</guid>
		<description><![CDATA[
Since late last year it is now possible to add Facebook Like buttons to Static FBML tab on your Facebook page. You can add as many as you like as long as the have a unique &#8220;xid&#8221; parameter for each like button. &#8220;returnurl&#8221; is the parameter for the URL you want users to like. The [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-449 alignnone" title="facebook_likes" src="http://www.sundh.com/blog/wp-content/uploads/2011/01/facebook_likes.jpg" alt="facebook_likes" width="458" height="241" /></p>
<p>Since late last year it is now possible to add <a href="http://developers.facebook.com/docs/reference/plugins/like" target="_blank">Facebook Like buttons</a> to <a href="http://www.facebook.com/apps/application.php?id=4949752878" target="_blank">Static FBML</a> tab on your Facebook page. You can add as many as you like as long as the have a unique &#8220;xid&#8221; parameter for each like button. &#8220;returnurl&#8221; is the parameter for the URL you want users to like. The code for one like button looks like this:</p>
<p><!-- .subtitle_left {display:none;} .comment_body {display:none;} --></p>
<p>// Code for my Like button</p>
<h3>Showing only the Like button</h3>
<p>Style sheet at the top has been added to hide elements which is included in the <a href="http://developers.facebook.com/docs/reference/fbml/comments" target="_blank">fb:comments</a> set, this set displays Facebook&#8217;s comments functionality by default. Make sure to place the css above your FBML tags.</p>
<ul>
<li>&#8220;.comment_body&#8221; displays the comments.</li>
</ul>
<ul>
<li>&#8220;.subtitle_left&#8221; displays a small Facebook icon with the text &#8220;Facebook social plugin&#8221; below the Like button.</li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2011/01/how-to-add-facebook-like-buttons-to-your-tab/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Post to Facebook with Javascript SDK</title>
		<link>http://www.sundh.com/blog/2010/12/post-to-facebook-with-javascript-sdk/</link>
		<comments>http://www.sundh.com/blog/2010/12/post-to-facebook-with-javascript-sdk/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 12:55:12 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Facebook Connect]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[social networks]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=408</guid>
		<description><![CDATA[Posting a message to someones wall can contain the following parameters:

var my_message = &#8216;This is just a test!&#8217;;
var url = &#8216;http://www.sundh.com/&#8217;;
var title = &#8216;This is the name of my post&#8217;;
var desc = &#8216;Optional description of my link&#8217;;
var picUrl = &#8216;http://www.sundh.com/blog/images/led.jpg&#8217;;

To post the following to my wall this javascript code is executed:

FB.api&#40;&#8216;/me/feed&#8217;, &#8216;post&#8217;, &#123;message:my_message,link:url,name:title,picture:picUrl,description:desc &#125;,
function&#40;response&#41; &#123;
if [...]]]></description>
			<content:encoded><![CDATA[<p>Posting a message to someones wall can contain the following parameters:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">var</span> my_message <span class="sy0">=</span> <span class="st0">&#8216;This is just a test!&#8217;</span><span class="sy0">;</span><br />
<span class="kw2">var</span> url <span class="sy0">=</span> <span class="st0">&#8216;http://www.sundh.com/&#8217;</span><span class="sy0">;</span><br />
<span class="kw2">var</span> title <span class="sy0">=</span> <span class="st0">&#8216;This is the name of my post&#8217;</span><span class="sy0">;</span><br />
<span class="kw2">var</span> desc <span class="sy0">=</span> <span class="st0">&#8216;Optional description of my link&#8217;</span><span class="sy0">;</span><br />
<span class="kw2">var</span> picUrl <span class="sy0">=</span> <span class="st0">&#8216;http://www.sundh.com/blog/images/led.jpg&#8217;</span><span class="sy0">;</span></div>
</div>
<p>To post the following to my wall this javascript code is executed:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">FB.<span class="me1">api</span><span class="br0">&#40;</span><span class="st0">&#8216;/me/feed&#8217;</span><span class="sy0">,</span> <span class="st0">&#8216;post&#8217;</span><span class="sy0">,</span> <span class="br0">&#123;</span>message<span class="sy0">:</span>my_message<span class="sy0">,</span>link<span class="sy0">:</span>url<span class="sy0">,</span><span class="kw3">name</span><span class="sy0">:</span>title<span class="sy0">,</span>picture<span class="sy0">:</span>picUrl<span class="sy0">,</span>description<span class="sy0">:</span>desc <span class="br0">&#125;</span><span class="sy0">,</span><br />
<span class="kw2">function</span><span class="br0">&#40;</span>response<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>response <span class="sy0">||</span> response.<span class="me1">error</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&#8216;Error occured&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
<span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&#8216;Post ID: &#8216;</span> <span class="sy0">+</span> response.<span class="me1">id</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>If I decided to not define the parameter &#8220;description&#8221; the post will grab the text appearing on the URL.<br />
<img class="size-full wp-image-414 alignnone" title="facebook_post" src="http://www.sundh.com/blog/wp-content/uploads/2010/12/facebook_post1.jpg" alt="facebook_post" width="360" height="186" /></p>
<h3>Youtube clip</h3>
<p>Posting a YouTube clip to someone&#8217;s wall requires a little bit different code in order to be able to play the YouTube clip within Facebook. Note that the URL to the YouTube clip is different from the URL shown in the browser when you watch the clip. Instead of &#8220;http://www.youtube.com/watch?v=VIDEO_ID&#8221;, it is set to &#8220;http://www.youtube.com/v/VIDEO_ID&#8221;. The thumbnail of the YouTube clips is easly retreived by accesing the URL &#8220;http://img.youtube.com/vi/VIDEO_ID/0.jpg&#8221;. </p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">var</span> my_message <span class="sy0">=</span> <span class="st0">&#8216;My message here&#8217;</span><span class="sy0">;</span><br />
<span class="kw2">var</span> url <span class="sy0">=</span> <span class="st0">&#8216;http://www.youtube.com/v/VIDEO_ID&#8217;</span><span class="sy0">;</span><br />
<span class="kw2">var</span> title <span class="sy0">=</span> <span class="st0">&#8216;Title of YouTube clip&#8217;</span><span class="sy0">;</span><br />
<span class="kw2">var</span> desc <span class="sy0">=</span> <span class="st0">&#8216;Description of YouTube clip&#8217;</span><span class="sy0">;</span><br />
<span class="kw2">var</span> picUrl <span class="sy0">=</span> <span class="st0">&#8216;http://img.youtube.com/vi/VIDEO_ID/0.jpg&#8217;</span><span class="sy0">;</span></div>
</div>
<p>The trick that makes the YouTube clip embeddable on Facebook is to add the parameter &#8220;source&#8221; in you API call to Facebook. The source is the same as the URL to the video clip.</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">FB.<span class="me1">api</span><span class="br0">&#40;</span><span class="st0">&#8216;/me/feed&#8217;</span><span class="sy0">,</span> <span class="st0">&#8216;post&#8217;</span><span class="sy0">,</span> <span class="br0">&#123;</span>message<span class="sy0">:</span>my_message<span class="sy0">,</span>link<span class="sy0">:</span>url<span class="sy0">,</span><span class="kw3">name</span><span class="sy0">:</span>title<span class="sy0">,</span>picture<span class="sy0">:</span>picUrl<span class="sy0">,</span>source<span class="sy0">:</span>url<span class="sy0">,</span>description<span class="sy0">:</span>desc <span class="br0">&#125;</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>response<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>response <span class="sy0">||</span> response.<span class="me1">error</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&#8216;Error occured&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&#8216;Post ID: &#8216;</span> <span class="sy0">+</span> response.<span class="me1">id</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>The result looks like this:<br />
<img class="size-full wp-image-427 alignnone" title="facebook_youtube" src="http://www.sundh.com/blog/wp-content/uploads/2010/12/facebook_youtube.jpg" alt="facebook_youtube" width="435" height="216" /></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2010/12/post-to-facebook-with-javascript-sdk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Like button on dynamic urls</title>
		<link>http://www.sundh.com/blog/2010/12/like-button-on-dynamic-urls/</link>
		<comments>http://www.sundh.com/blog/2010/12/like-button-on-dynamic-urls/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 10:02:26 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Like button]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=353</guid>
		<description><![CDATA[I mentioned in the previous post how to sort your the number of likes of different URLS. In some cases you might wanna sort urls of the same domain to see the post popular post, the most popular product in your web shop or what have you. In order to have several Like buttons on [...]]]></description>
			<content:encoded><![CDATA[<p>I mentioned in the previous post how to sort your the number of likes of different URLS. In some cases you might wanna sort urls of the same domain to see the post popular post, the most popular product in your web shop or what have you. In order to have several Like buttons on one page each Like button needs to point to a unique URL, in many cases this is a dynamic URL generated to display the unique content.</p>
<p>For Facebook to recognize the dynamic page as a unique page it helps to set their meta tags:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="sy0">&lt;</span>meta property<span class="sy0">=</span><span class="st0">&quot;og:title&quot;</span> content<span class="sy0">=</span><span class="st0">&quot;My dynamic title&quot;</span><span class="sy0">/&gt;</span><br />
<span class="sy0">&lt;</span>meta property<span class="sy0">=</span><span class="st0">&quot;og:type&quot;</span> content<span class="sy0">=</span><span class="st0">&quot;article&quot;</span><span class="sy0">/&gt;</span><br />
<span class="sy0">&lt;</span>meta property<span class="sy0">=</span><span class="st0">&quot;og:url&quot;</span> content<span class="sy0">=</span><span class="st0">&quot;http://www.mydomain.com/page.php?id=my_dynamic_url&quot;</span><span class="sy0">/&gt;</span><br />
<span class="sy0">&lt;</span>meta property<span class="sy0">=</span><span class="st0">&quot;og:image&quot;</span> content<span class="sy0">=</span><span class="st0">&quot;http://www.mydomain.com/unique_image_for_the_url.jpg&quot;</span><span class="sy0">/&gt;</span><br />
<span class="sy0">&lt;</span>meta property<span class="sy0">=</span><span class="st0">&quot;og:site_name&quot;</span> content<span class="sy0">=</span><span class="st0">&quot;My site name&quot;</span><span class="sy0">/&gt;</span><br />
<span class="sy0">&lt;</span>meta property<span class="sy0">=</span><span class="st0">&quot;og:description&quot;</span>content<span class="sy0">=</span><span class="st0">&quot;My unique description for the dynamic url&quot;</span><span class="sy0">/&gt;</span></div>
</div>
<p>Proof test your URLs here: <a href="http://developers.facebook.com/tools/lint/" target="_blank">Facebook URL Linter</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2010/12/like-button-on-dynamic-urls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get likes on urls from Facebook</title>
		<link>http://www.sundh.com/blog/2010/11/get-likes-on-urls-from-facebook/</link>
		<comments>http://www.sundh.com/blog/2010/11/get-likes-on-urls-from-facebook/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 17:01:20 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=339</guid>
		<description><![CDATA[Sometimes you might wanna list things on your site order by the popularity on Facebook. It can also be a handy tool compare your different sites Facebook likes and get social stats from it. Facebook offer a very handy service to check this without being logged in to Facebook in any way. Check the service [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you might wanna list things on your site order by the popularity on Facebook. It can also be a handy tool compare your different sites Facebook likes and get social stats from it. Facebook offer a very handy service to check this without being logged in to Facebook in any way. Check the service we use <a href="http://api.facebook.com/restserver.php?method=links.getStats&amp;urls=http://www.google.com,http://www.facebook.com" target="_blank">here</a>. Facebook will retreive all Facebook likes, share count and total counts of these. For each link, it will display:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="sy0">&lt;</span>link_stat<span class="sy0">&gt;</span><br />
<span class="sy0">&lt;</span>url<span class="sy0">&gt;</span>http<span class="sy0">:</span><span class="co1">//www.google.com&lt;/url&gt;</span><br />
<span class="sy0">&lt;</span>share_count<span class="sy0">&gt;</span><span class="nu0">295804</span><span class="sy0">&lt;/</span>share_count<span class="sy0">&gt;</span><br />
<span class="sy0">&lt;</span>like_count<span class="sy0">&gt;</span><span class="nu0">153002</span><span class="sy0">&lt;/</span>like_count<span class="sy0">&gt;</span><br />
<span class="sy0">&lt;</span>comment_count<span class="sy0">&gt;</span><span class="nu0">177545</span><span class="sy0">&lt;/</span>comment_count<span class="sy0">&gt;</span><br />
<span class="sy0">&lt;</span>total_count<span class="sy0">&gt;</span><span class="nu0">626351</span><span class="sy0">&lt;/</span>total_count<span class="sy0">&gt;</span><br />
<span class="sy0">&lt;</span>click_count<span class="sy0">&gt;</span><span class="nu0">265614</span><span class="sy0">&lt;/</span>click_count<span class="sy0">&gt;</span><br />
<span class="sy0">&lt;</span>normalized_url<span class="sy0">&gt;</span>http<span class="sy0">:</span><span class="co1">//www.google.com/&lt;/normalized_url&gt;</span><br />
<span class="sy0">&lt;</span>comments_fbid<span class="sy0">&gt;</span><span class="nu0">381702034999</span><span class="sy0">&lt;/</span>comments_fbid<span class="sy0">&gt;</span><br />
<span class="sy0">&lt;/</span>link_stat<span class="sy0">&gt;</span></div>
</div>
<h4>Get total likes on urls</h4>
<p>With a loop in php we can get the information we need:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">function</span> getLikes<span class="br0">&#40;</span><span class="re0">$arr</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="re0">$urls</span> <span class="sy0">=</span> <span class="st0">&quot;&quot;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; <span class="co1">// Add urls to check for likes</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">for</span><span class="br0">&#40;</span><span class="re0">$i</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span><span class="re0">$i</span> <span class="sy0">&lt;</span> <a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">&#40;</span><span class="re0">$arr</span><span class="br0">&#41;</span><span class="sy0">;</span><span class="re0">$i</span><span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$urls</span> <span class="sy0">!=</span> <span class="st0">&quot;&quot;</span><span class="br0">&#41;</span> <span class="re0">$urls</span> <span class="sy0">.=</span> <span class="st0">&quot;,&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$urls</span> <span class="sy0">.=</span> <span class="re0">$arr</span><span class="br0">&#91;</span><span class="re0">$i</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; <span class="co1">// Retreive info from Facebook</span><br />
&nbsp; &nbsp; &nbsp; <span class="re0">$facebookapi</span> <span class="sy0">=</span> <span class="st0">&quot;http://api.facebook.com/restserver.php?method=links.getStats&amp;urls=&quot;</span> <span class="sy0">.</span> <span class="re0">$urls</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="re0">$xml</span> <span class="sy0">=</span> <a href="http://www.php.net/simplexml_load_file"><span class="kw3">simplexml_load_file</span></a><span class="br0">&#40;</span><span class="re0">$facebookapi</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; <span class="re0">$likes</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="co1">// Loop through the result and populate an array with the likes</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="re0">$i</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span><span class="re0">$i</span> &nbsp;<span class="sy0">&lt;</span> <a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">&#40;</span><span class="re0">$arr</span><span class="br0">&#41;</span><span class="sy0">;</span><span class="re0">$i</span><span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$url</span> <span class="sy0">=</span> <span class="re0">$xml</span><span class="sy0">-&gt;</span><span class="me1">link_stat</span><span class="br0">&#91;</span><span class="re0">$i</span><span class="br0">&#93;</span><span class="sy0">-&gt;</span><span class="me1">url</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$counts</span> <span class="sy0">=</span> <span class="br0">&#40;</span>int<span class="br0">&#41;</span><span class="re0">$xml</span><span class="sy0">-&gt;</span><span class="me1">link_stat</span><span class="br0">&#91;</span><span class="re0">$i</span><span class="br0">&#93;</span><span class="sy0">-&gt;</span><span class="me1">like_count</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$likes</span><span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&quot;likes&quot;</span> <span class="sy0">=&gt;</span> <span class="re0">$counts</span><span class="sy0">,</span> <span class="st0">&quot;url&quot;</span> <span class="sy0">=&gt;</span> <span class="re0">$url</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$likes</span><span class="sy0">;</span></p>
<p><span class="br0">&#125;</span></p>
<p><span class="co1">// Array with links to the URLs we want to get number of likes from</span><br />
<span class="re0">$array</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&quot;http://www.google.com&quot;</span><span class="sy0">,</span><span class="st0">&quot;http://www.apple.com&quot;</span><span class="sy0">,</span><span class="st0">&quot;http://www.facebook.com&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="re0">$likes</span> <span class="sy0">=</span> getLikes<span class="br0">&#40;</span><span class="re0">$array</span><span class="br0">&#41;</span><span class="sy0">;</span></p>
<p><span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$likes</span> <span class="kw1">as</span> <span class="re0">$key</span> <span class="sy0">=&gt;</span> <span class="re0">$val</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">echo</span> <span class="re0">$key</span> <span class="sy0">.</span> <span class="st0">&quot; =&gt; &quot;</span> <span class="sy0">.</span> <span class="re0">$val</span><span class="br0">&#91;</span><span class="st0">&quot;url&quot;</span><span class="br0">&#93;</span> <span class="sy0">.</span> <span class="st0">&quot; =&gt; &quot;</span> <span class="sy0">.</span> <span class="re0">$val</span><span class="br0">&#91;</span><span class="st0">&quot;likes&quot;</span><span class="br0">&#93;</span> <span class="sy0">.</span> <span class="st0">&quot;&lt;br /&gt;&quot;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<h4>Sorting the likes</h4>
<p>After retrieving the likes, the array can be sorted by most popular url.</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="re0">$likes</span> <span class="sy0">=</span> array_sort<span class="br0">&#40;</span><span class="re0">$likes</span><span class="sy0">,</span> <span class="st0">&quot;likes&quot;</span><span class="sy0">,</span> SORT_DESC<span class="br0">&#41;</span><span class="sy0">;</span></p>
<p><span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$likes</span> <span class="kw1">as</span> <span class="re0">$key</span> <span class="sy0">=&gt;</span> <span class="re0">$val</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">echo</span> <span class="re0">$key</span> <span class="sy0">.</span> <span class="st0">&quot; =&gt; &quot;</span> <span class="sy0">.</span> <span class="re0">$val</span><span class="br0">&#91;</span><span class="st0">&quot;url&quot;</span><span class="br0">&#93;</span> <span class="sy0">.</span> <span class="st0">&quot; =&gt; &quot;</span> <span class="sy0">.</span> <span class="re0">$val</span><span class="br0">&#91;</span><span class="st0">&quot;likes&quot;</span><span class="br0">&#93;</span> <span class="sy0">.</span> <span class="st0">&quot;&lt;br /&gt;&quot;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p><a href="http://www.sundh.com/dev/get_likes.txt" target="_blank">Download source</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2010/11/get-likes-on-urls-from-facebook/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Add Facebook Connect to your blog comments</title>
		<link>http://www.sundh.com/blog/2009/12/add-facebook-connect-to-your-blog-in-8-minutes/</link>
		<comments>http://www.sundh.com/blog/2009/12/add-facebook-connect-to-your-blog-in-8-minutes/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 10:09:08 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Facebook Connect]]></category>
		<category><![CDATA[social networks]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=44</guid>
		<description><![CDATA[This neat video explains how you can add Facebook Connect to your blog and let users add comments by logging into Facebook Connect! No server-side scripting needed!
]]></description>
			<content:encoded><![CDATA[<p>This neat video explains how you can add Facebook Connect to your blog and let users add comments by logging into Facebook Connect! No server-side scripting needed!<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="576" height="324" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.facebook.com/v/630563174283" /><param name="wmode" value="opaque" /><embed type="application/x-shockwave-flash" width="576" height="324" src="http://www.facebook.com/v/630563174283" wmode="opaque" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2009/12/add-facebook-connect-to-your-blog-in-8-minutes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hooked on Café World?</title>
		<link>http://www.sundh.com/blog/2009/12/hooked-on-cafe-world/</link>
		<comments>http://www.sundh.com/blog/2009/12/hooked-on-cafe-world/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 15:06:13 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[zynga]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=28</guid>
		<description><![CDATA[New to Café World? It is one of many games made by Zynga. The game can only be played on Facebook and you can invite your friends on Facebook. From today the game hs more users than Twitter and the number of users have rapidly increased over a week. Read more about it here!
http://www.insidesocialgames.com/2009/10/08/zyngas-cafe-world-goes-from-0-to-8-6-million-users-in-a-week-with-big-implications/
My cafe:]]></description>
			<content:encoded><![CDATA[<p>New to Café World? It is one of many games made by Zynga. The game can only be played on Facebook and you can invite your friends on Facebook. From today the game hs more users than Twitter and the number of users have rapidly increased over a week. Read more about it here!<br />
<a href="http://www.insidesocialgames.com/2009/10/08/zyngas-cafe-world-goes-from-0-to-8-6-million-users-in-a-week-with-big-implications/" rel="nofollow">http://www.insidesocialgames.com/2009/10/08/zyngas-cafe-world-goes-from-0-to-8-6-million-users-in-a-week-with-big-implications/</a></p>
<p>My cafe:</p>
<div id="attachment_29" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-29" title="cafe" src="http://www.sundh.com/blog/wp-content/uploads/2009/12/cafe-300x202.jpg" alt="Café" width="300" height="202" /><p class="wp-caption-text">Café</p></div>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2009/12/hooked-on-cafe-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prefill Facebook private messages</title>
		<link>http://www.sundh.com/blog/2009/10/prefill-facebook-private-messages/</link>
		<comments>http://www.sundh.com/blog/2009/10/prefill-facebook-private-messages/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 13:02:13 +0000</pubDate>
		<dc:creator>Ellen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[social networks]]></category>

		<guid isPermaLink="false">http://www.sundh.com/blog/?p=8</guid>
		<description><![CDATA[I just found this neat little feature on Facebook which allows you to send prefilled messages to a person on Facebook.
Fill in:
id (must be the number id)
subject (string)
message (string)
The whole link looks like this:
http://www.facebook.com/inbox/?compose&#38;id=652519918&#38;message=I%20am%20writing%20to%20you..&#38;subject=Just%20checked%20your%20blog!]]></description>
			<content:encoded><![CDATA[<p>I just found this neat little feature on Facebook which allows you to send prefilled messages to a person on Facebook.</p>
<p>Fill in:</p>
<p>id (must be the number id)<br />
subject (string)<br />
message (string)</p>
<p>The whole link looks like this:</p>
<p><a href="http://www.facebook.com/inbox/?compose&amp;id=652519918&amp;message=I%20am%20writing%20to%20you..&amp;subject=Just%20checked%20your%20blog!" target="_blank"><a href="http://www.facebook.com/inbox/?compose&amp;id=652519918&amp;message=I%20am%20writing%20to%20you..&amp;subject=Just%20checked%20your%20blog" rel="nofollow">http://www.facebook.com/inbox/?compose&amp;id=652519918&amp;message=I%20am%20writing%20to%20you..&amp;subject=Just%20checked%20your%20blog</a>!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sundh.com/blog/2009/10/prefill-facebook-private-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

