Sharing a link to your facebook wall from your external application

Goodmorning Kolkata, a new day, a new requirement from the client. His post on basecamp says, though he appreciates the fact that a photo could be directly uploaded to ones facebook album, it doesn't really appeal him much. Why? Ummm... tough question. He wants something simpler, sweeter and less painful (uploading images from external applications to facebook required the user to approve them on facebook before they could go live...extra clicks are painful alright) than the above method. In fact facebook also realizes this I guess and thus offers us exactly what we are looking for:
http://www.facebook.com/sharer.php

The above URL expects two parameter, 'u' and 't'. 'u' is the link you want to share, 't' is the additional title you want to supply Facebook in case it is unable to crawl through the title of the page provided in the link. So for example a complete link should look something like this:
http://www.facebook.com/sharer.php?u=http://your-website.com/your-page.html&t=Welcome to my page

That's it. Once your user clicks on the above link, he/she would be first authenticated to Facebook, and then would be able to publish the link with a description and title, neatly to his/her wall. The moment it gets on to the users wall, all of his/her friends would get them on their walls as well, as part of feed. Cool way to share, huh?

Few points worth mentioning. If you want to pass more information to the Facebook sharer, use meta and link tags. In my case I was required to show an image on the wall itself from the target link. I added the following tags after the end of HTML tag of my page (i.e. the page which was passed as link through 'u' to sharer.php).

meta name="title" content="Additional title you might want to pass"
meta name="description" content="The description of the link which would show up on the wall"
link rel="image_src" href="http://your-website.com/inages/yourphoto.jpg"

That's it. You are done, Enjoy your cool little application and keep shareing links on your Facebook wall.

Comments

Tom Fuller said…
Thanks for sharing this simple explanation! Very useful. I plan to make it a part of a component I work on for Joomla.

Popular posts from this blog

uTorrent: Data error (cyclic redundancy check)

Khude Jajabor Istasi

Photo upload to Facebook from your PHP web application