Open Social Phpcamp


Published on

opensocial talk given by pravin nirmal in phpcamp

Published in: Technology
1 Comment
1 Like
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Open Social Phpcamp

    1. 1. OpenSocial Creating Orkut Applications
    2. 2. Before We Start… <ul><li>If you have any questions, please don't hesitate to ask. </li></ul><ul><li>During presentation we will create a sample application and run at Orkut. </li></ul><ul><li>This session is not about OpenSocial container/Shindig. </li></ul>
    3. 3. About Me <ul><li>Doing PHP since 2000. </li></ul><ul><li>Service Delivery Manager </li></ul><ul><li>@ Clarion Technologies Pvt. Ltd. </li></ul><ul><li>CMMI Level 3 Company </li></ul><ul><li>My application “Cities I visited” listed at Orkut directory. </li></ul>
    4. 4. Something about you… <ul><li>How many of you know OpenSocial? </li></ul><ul><li>How many of you used Facebook Applications? </li></ul><ul><li>How many of you used Orkut Applications?. </li></ul>
    5. 5. Why OpenSocial? <ul><li>Facebook has its own API. It became popular with launch of applications. </li></ul><ul><li>There are many other networking sites like Orkut, MySpace, hi5, linkedin etc. </li></ul><ul><li>What if all creates their own API? Developer will have to create different application for each platform. </li></ul>
    6. 6. What an idea…
    7. 7. What is OpenSocial? <ul><li>OpenSocial defines a common API for social applications across multiple websites. Built from standard JavaScript and HTML, developers can create apps with OpenSocial that access a social network's friends and update feeds. </li></ul>
    8. 8. Journey of OpenSocial <ul><li>Launched on November 1, 2007 with initial version 0.5 </li></ul><ul><li>Initially supported by Friendster, hi5, MySpace, Ning, orkut and many more. </li></ul><ul><li>At launch Flixster, FotoFlexer, iLike, Newsgator, RockYou, Slide, Theikos, and VirtualTourist presented applications. </li></ul><ul><li>Current version 0.8 released on May 28, 2008. </li></ul>
    9. 9. Who all are using it.
    10. 10. Basics… <ul><li>Simple “Hello World” Application (helloworld.xml) </li></ul><ul><li><?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?> </li></ul><ul><li><Module> </li></ul><ul><li><ModulePrefs title=&quot;Hello World!&quot;> </li></ul><ul><li><Require feature=&quot;opensocial-0.8&quot; /> </li></ul><ul><li></ModulePrefs> </li></ul><ul><li><Content type=&quot;html&quot;> </li></ul><ul><li><![CDATA[ Hello, world!]]> </li></ul><ul><li></Content> </li></ul><ul><li></Module> </li></ul>
    11. 11. Listing Friends … 1 - xml <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> </li></ul><ul><li><Module> </li></ul><ul><li><ModulePrefs title=“PHPCamp- List Friends&quot;> </li></ul><ul><li><Require feature=&quot;opensocial-0.7&quot;/> </li></ul><ul><li></ModulePrefs> </li></ul><ul><li><Content type=&quot;html&quot;> </li></ul><ul><li><![CDATA[ <script type=&quot;text/javascript&quot;> /* ... */ </script> </li></ul><ul><li><div id='main'> </li></ul><ul><li>Your friends: <div id='friends'></div> </li></ul><ul><li></div> </li></ul><ul><li>]]> </Content> </Module> </li></ul>
    12. 12. Listing Friends … 2- js <ul><li><script language=“JavaScript”> </li></ul><ul><li>gadgets.util.registerOnLoadHandler(init); </li></ul><ul><li>function init() { </li></ul><ul><li>var req = opensocial.newDataRequest(); </li></ul><ul><li>var opt_params = {}; </li></ul><ul><li>opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 20; </li></ul><ul><li> req.add(req.newFetchPeopleRequest( 'OWNER_FRIENDS' ,opt_params), 'ownerFriends' ); </li></ul><ul><li>req.send( onLoadFriends ); </li></ul><ul><li>} </li></ul><ul><li></script> </li></ul>
    13. 13. Listing Friends … 3- js <ul><li>function onLoadFriends(data) { </li></ul><ul><li>var viewerFriends = data.get(' viewerFriends ').getData(); </li></ul><ul><li>var html=&quot;&quot;; </li></ul><ul><li>html=' <ul> '; </li></ul><ul><li>viewerFriends.each( function (person) { </li></ul><ul><li>var friend_thumbnail = person.getField(opensocial.Person.Field.THUMBNAIL_URL); </li></ul><ul><li>html +=' <li> ' + person.getDisplayName() + '<img src= &quot;'+friend_thumbnail+'&quot; > </li> '; </li></ul><ul><li>}); </li></ul><ul><li>html +=' </ul> '; </li></ul><ul><li>document.getElementById(' friends ').innerHTML = html; </li></ul><ul><li>} </li></ul>
    14. 14. Listing Friends … 4- output
    15. 15. What else you can do <ul><li>Send request to your server and return information in text,XML or JSON format. </li></ul><ul><li>Insert activity in users updates. </li></ul><ul><li>Use of AJAX. </li></ul><ul><li>Store information at Orkut server. </li></ul><ul><li>Fetch owner and his friends information. </li></ul>
    16. 16. What you can’t do <ul><li>Post scraps through your application. </li></ul><ul><li>Fetch personal information like phone number, birth date etc. </li></ul><ul><li>Communicate between different OpenSocial sites. </li></ul><ul><li>Any change at Orkut site. Application runs only at the space allocated to it e.g. profile view and container view. </li></ul><ul><li>Run exactly same application on all supported sites. </li></ul>
    17. 17. References… <ul><li>Orkut OpenSocial Blog </li></ul><ul><li>Orkut Developer Forum </li></ul><ul><li>Orkut developer Guide </li></ul><ul><li>OpenSocial Tutorial </li></ul>
    18. 18. That’s it! <ul><li>If you have any questions, don't hesitate to ask. </li></ul><ul><li>Demonstration scripts and forms can be seen under </li></ul><ul><li> </li></ul><ul><li>Feel free to contact me at [email_address] </li></ul>
    19. 19. Thanks a lot for your interest.