Drupal: Facebook-style Micropublisher

After months of hard work and support from Isaac and Thomas, I am proud to announce the first stable release of Facebook-style Micropublisher (FBSMP). FBSMP allows user to share content such as links, videos, photos and documents along with their Facebook-style Statuses. It allows you to create a social networking site similar to Twitter, Facebook, Google Buzz and others out-of-the-box. On the top, it integrates with a lot of other Drupal modules (as Activity, Trigger, Rules, Heartbeat, ImageCache, EmVideo, UserPoints, and more) which lets you do a lot more things with your website....

December 24, 2010 · 2 min

Drupal: Facebook-style Micropublisher Preview

I worked on the module Facebook-style Micropublisher (FBSMP) for Drupal, this summer as part of the Google Summer of Code program mentored by Isaac Sukin. This module lets users publish content (links, images, videos and documents) in a stream, along with their Facebook-style Statuses (like on Facebook, or Twitter). When I say that I worked on it as part of GSoC, it would be only partly true. I started working on it around March 2010, when I was contacted by Thomas to create a Drupal module for his site which would imitate the link share feature from Facebook, Google Buzz. I wrote the small module Facebook-style Links, which worked quite well but it was then this occurred to me, “why not create a module which can publish any content, which is extensible to publish any kind of content like images, links, videos, documents, audio, etc”. Today, I am happy to say that Drupal now has a complete Micropublisher which can be used to create any kind of microblogging platform such as Facebook, Google Buzz, Twitter, etc. I will be posting the first release of the module soon, but before here is the small list of features and a few screenshots.

November 22, 2010 · 2 min

PHP: Encoding a URL before accessing it

I discussed a little about URL encoding in my recent post Facebook: Bug with URL encoding, although it seems like the bug still exists. In this post I will discuss “how to encode a given URL before accessing it using CURL or fsockopen”. The problem with URLs is that they might contain certain disallowed characters like spaces, according to RFC 3986. Our aim is to convert these invalid characters to their percentage encoded values in a given URL , so that we can access the URL using our regular HTTP request methods. For example the URL [http://example.com/space space] should be converted to [http://example.com/space%20space] before we can access it using CURL. However, the URL [http://example.com/percents%25percent] is perfectly valid as it doesn’t contains any of the disallowed characters.

May 8, 2010 · 2 min

Facebook: Bug with URL encoding

Today, while I was working on the URL encoding for the recently released Facebook-style Links module, I realized a bug with Link Attachments feature on Facebook. Before I explain, let us reproduce it: Try to attach the following link on Facebook: http://google.com/search?q=blenders%26pride. This URL actually queries Google for ‘blenders&pride’. Facebook converts/encodes the above URL to http://google.com/search?q=blenders&pride which is not the same as above and queries Google for just ‘blenders’. So, why Facebook does this? Probably Facebook tries to encode the URL to remove the characters which are not allowed by RFC 3986 and replaces them with their percent encoding. But there are certain characters which should not be encoded, such as ‘/’, ‘?’, ‘#’, ‘@’ which are the reserved characters and used as delimiters in the URL. So, it decodes these characters and converts their encoding to the original character which gives rise to the problem. Let us see an example:

March 12, 2010 · 2 min