Monday, November 5, 2007
Small Task
These days I am trying to understand how the whole connectivity thing works. How do you post your contents (which may be normal HTML pages or flash widgets) to your favorite sites? The answer is pretty simple. You host your contents some where else and give the code which accesses these hosted files in your favorite site(say blogger). But how do you add external content to some site which is intended to give you only their stuff?? Blogger does this but allowing the used to add scripts and HTML content as page elements. I was given the task of finding how I can post something (say a flash file -swf) to facebook.
At first I thought of the task to be a simple one. Go to some site which has used the actual add to Facebook button and use http header and trackers to get the URL that is used to add contents to facebook. As my content was a widget, I decided to look through widgetbox. The site is a great site where you could actually make widgets (even write custom code) , save them and even add these widgets to your facebook account. The URL too was simple. It used the sharer.php page of facebook.
Now when i actually access the page I see a input box where in I am supposed to add my URL. Adding the widget.com URL worked fine, but when I added my flash video (hosted at my side), I got just the URL and no flash video. I started looking at the part where it shows a confirmation and saw many hidden variables. For the widgetbox URL these hidden variables were filled. But how does it do that ?? The only difference I saw was the meta data that was present in the widgetbox html. After googling some time I got the page from facebook (yeah I am a dumbass) which said to use the meta tags to populate the hidden fields. It so happens that the guys in facebook are so smart that they get the meta tags from the inputted html page and according to certain specified tags they conclude the content of the page and render it accordingly making the shared page either a normal html page, a video clipping or an audio clipping. The various options are showed in this page.
It turns out that getting the meta tags is not great a deal either. PHP4 and later we get this information using get_meta_tags(URL) which returns you a map of the tags(Facebook seems to be php code :) ). They then may be populating the hidden fields which then ets submitted to the actual page. Nice and effective trick I say !! I don't think the same goes for all those social websites but I am yet to explore them (God bless ).
During this exploration I stumbled upon some thing that may be useful for the future too. Its called Open Social and its from our very own Google. It provides a set of APIs for social websites across multiple websites. As I understand you can write your own widgets which may do things for you in your account (like adding a scrap in orkut ) but its embeddable. Many websites implement these APIs and in the near future we may have a set of APIs which are common for all those social websites. I had to join in this great venture and I have got my approval. Yet to start with programming the orkut sandbox though !!
That's all for today. And see you the next time I have something to write !!! Ciao !
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment