137
Diving into the Yahoo! Open Stack h3p://developer.yahoo.com/ Dus>n Whi3le – dus>n@yahoo‐inc.com

Diving Into The Yahoo Open Stack @ SF PHP Meetup

Embed Size (px)

DESCRIPTION

Slides presented at San Francisco PHP meetup on April 2nd, 2009.

Citation preview

Page 1: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Diving into the Yahoo! Open Stack  

h3p://developer.yahoo.com/ Dus>n Whi3le – dus>n@yahoo‐inc.com 

Page 2: Diving Into The Yahoo Open Stack @ SF PHP Meetup

DEVELOPER.YAHOO.COM EXAMPLES | TUTORIALS | CODE SAMPLES 

Page 3: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YAHOO! IS POWERED BY OPEN SOURCE TECHNOLOGIES 

FREEBSD | LINUX | APACHE | PHP | MYSQL | BUGZILLA | HADOOP | SYMFONY 

Page 4: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YAHOO! EMBRACES OPEN STANDARDS W3C | MICROFORMATS | OAUTH | OPENID | OPENSOCIAL 

Page 5: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YAHOO! HIRES OPEN SOURCE DEVELOPERS RASMUS LERDORF | DOUG CROCKFORD | DOUG CUTTING | CHRISTIAN HEILMANN 

Page 6: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YAHOO! GIVES BACK TO OPEN SOURCE YUI | BROWSER PLUS | DESIGN PATTERNS | R3 | YSLOW + PERFORMANCE RULES 

Page 7: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YAHOO! SHARES ITS DATA THROUGH OPEN APIS AND WEB SERVICES 

YQL | PIPES | BOSS | CONTACTS | UPDATES | MAIL | DELICIOUS | FLICKR | UPCOMING | HOTJOBS | MAPS | FIREEAGLE | GEOLOCATION | LOCAL | TRAFFIC | WEATHER | 

MUSIC | ANSWERS | SHOPPING | FINANCE | TRAVEL 

Page 8: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YAHOO! ENGAGES COMMUNITIES WITH OPEN HACK EVENTS AROUND THE WORLD 

Hack Days | HackU | Tech Talks | YDN Theater 

Page 9: Diving Into The Yahoo Open Stack @ SF PHP Meetup

WE ARE OPEN AT YAHOO! 

Page 10: Diving Into The Yahoo Open Stack @ SF PHP Meetup

PROGRESS. EVERYONE IS WORKING TOGETHER! 

Page 11: Diving Into The Yahoo Open Stack @ SF PHP Meetup

OPEN PLATFORMS + COLLABORATION OPENID | XRDS | OAUTH | PORTABLE CONTACTS | OPEN SOCIAL 

Page 12: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 13: Diving Into The Yahoo Open Stack @ SF PHP Meetup

h3p://developer.yahoo.com/yos/ 

Y! OS – The Open Stack 

Page 14: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 15: Diving Into The Yahoo Open Stack @ SF PHP Meetup

developer.yahoo.com 

Page 16: Diving Into The Yahoo Open Stack @ SF PHP Meetup

developer.yahoo.com 

Page 17: Diving Into The Yahoo Open Stack @ SF PHP Meetup

developer.yahoo.com 

Page 18: Diving Into The Yahoo Open Stack @ SF PHP Meetup

developer.yahoo.com 

Page 19: Diving Into The Yahoo Open Stack @ SF PHP Meetup

developer.yahoo.com 

Page 20: Diving Into The Yahoo Open Stack @ SF PHP Meetup

SearchMonkey + BOSS 

Page 21: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 22: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 23: Diving Into The Yahoo Open Stack @ SF PHP Meetup

A simple Blueprint Example 

Page 24: Diving Into The Yahoo Open Stack @ SF PHP Meetup

The Yahoo! Developer Network offers open source tools and open data APIs to make it easy for developers to build 

applica>ons and mashups. 

•  50+ APIs / Web Services –  Developer Dashboard –  Tutorials + Code Samples –  API Documenta>on 

•  Yahoo! User Interface libraries + ASTRA •  Design Pa3erns Library •  PHP / Python / Ruby Dev Centers •  Blogs / Theater / Events / Evangelism 

What is Yahoo! Developer Network? 

Page 25: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 26: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 27: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  JavaScript Framework – UOliOes ‐ YAHOO, Dom, Event, AnimaOon, Browser History Manager, ConnecOon Manager, Cookie, DataSource, Drag and Drop, Element, Get, ImageLoader, JSON, Resize, Selector, Loader 

–  Controls / Widgets ‐ AutoComplete, BuXon, Calendar, Charts, Color Picker, DataTable, ImageCropper, Rich Text Editor, Slider, Uploader 

–  Container (Module, Overlay, Panel, ToolOp, Dialog), Layout Manager, Menu, TabView, TreeView 

– Debug – Logger, Profiler, Test 

Y! Developer Network – YUI JS 

Page 28: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  CSS FoundaOon – Reset ‐ Neutralizes browser CSS styles – Base ‐ Applies consistent style foundaOon – Fonts ‐ FoundaOon for typography and font‐sizing – Grids ‐ Thousands of wireframe layouts 

•  User Interface Design PaXerns Library – Proven soluOons to common interfaces – hXp://developer.yahoo.com/ypaXerns/ 

– Grade Browser Support / Progressive Enhancement 

Y! Developer Network – YUI CSS 

Page 29: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  More than 275 funcOonal examples – hXp://developer.yahoo.com/yui/examples/ 

•  YSlow + Performance Rules – hXp://developer.yahoo.com/performance 

•  YUI Blog – hXp://yuiblog.com/ 

•  Mailing List @ Yahoo! Groups – hXp://tech.groups.yahoo.com/group/ydn‐javascript/ 

Y! Developer Network – Documenta>on 

Page 30: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 31: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 32: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 33: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 34: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Yahoo! Open Strategy 

Page 35: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 36: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Y! OS – Unified Open Profile 

Page 37: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 38: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 39: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Y! OS – Open to 3rd‐par>es like never before 

•  Yahoo! Developer Network •  Developer Tools (YUI, etc) 

•  Social APIs •  Profiles •  ConnecOons •  Updates 

•  Data APIs •  OAuth 

•  Yahoo! Query Language •  Yahoo! ApplicaOon Plahorm 

•  OpenSocial 

Page 40: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Yahoo! Open Stack ‐ OAuth  

Page 41: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Yahoo! Open Stack ‐ OAuth  • 2‐legged & 3‐legged OAuth • Consumer Key / Consumer Secret • Similar to proprietary BBAuth, but open standard 

h3p://developer.yahoo.com/oauth/ 

Page 42: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 43: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 44: Diving Into The Yahoo Open Stack @ SF PHP Meetup

h3p://oauth.net/core/1.0 

Y! Open Stack – Doing the Dance  

Page 45: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 46: Diving Into The Yahoo Open Stack @ SF PHP Meetup

A Query Language for the Web 

SELECT  * FROM INTERNET 

Page 47: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  Thousands of Web Services that provide valuable data 

•  Require developers to read documentaOon and form URLs/queries. 

•  Data is isolated •  Needs combining, tweaking, shaping even aker it gets to the developer. 

Before YQL 

Page 48: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  SQL‐Like Language – Synonymous with Data access 

– Familiar to developers – Expressive enough to get the right data 

•  Self Describing ‐ show, desc table •  Allows you to query, filter and join data across Web Services. 

Y! Open Stack – YQL 

Page 49: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 50: Diving Into The Yahoo Open Stack @ SF PHP Meetup

50 

YQL Command: SHOW tables 

YQL – Available Tables 

Page 51: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  3 Verbs 

– show: lists the supported tables – desc: describes the structure of a table – select: fetches data Tables, Verbs, Filters 

YQL ‐ Verbs 

Page 52: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 53: Diving Into The Yahoo Open Stack @ SF PHP Meetup

53 

YQL Command: DESC social.connecOons 

YQL – Table Contents 

Page 54: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 55: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YQL Statements ‐ Basics 

SELECT what FROM collecOon 

WHERE filter condiOon 

IN (sub‐select) 

LIMIT n OFFSET nshow: 

Syntax 

Page 56: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YQL Statements ‐ Collec>ons 

•  FROM collecOon •  Yahoo! WebServices 

– Social Dir, Upcoming, MyblogLog, Y!Local, Search(BOSS) 

•  External DataSources – XML, Atom, RSS, JSON, CSV, HTML  

Syntax ‐> Select ‐> Collec>on 

Page 57: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  Table data can be filtered in the WHERE clause either – Remotely by the table data source – Locally by the YQL engine (dot notaOon) 

Syntax ‐> Select ‐> WHERE clause 

YQL Statements – Where 

Page 58: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YQL Statements ‐ Subselects 

•  IN (SELECT ...) –  Join across data sources – Field IN (select guid from ...) – Like SELECT but can return only N leaves 

Syntax ‐> Select ‐> Sub‐Select 

Get the profile for all my connec1ons: 

select * from social.profile where guid in (select guid from social.connec?ons where owner_guid = me) 

Page 59: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 60: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  Delicious •  Dopplr •  Friendfeed •  Github •  New York Times •  Shopping 

•  TwiXer •  Weather •  Wesabe •  Whitepages 

•  Zillow •  …. 

Available on github ‐ hXp://github.com/spullara/yql‐tables/ 

YQL ‐ Open Tables 

Page 61: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YQL – Open Tables 

Page 62: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YQL – Open Tables 

Page 63: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YQL – Open Tables 

Page 64: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YQL – Open Tables 

•  Schema defines mapping between YQL and Endpoint 

•  Keys can either be query, path or matrix parameters 

•  Keys can be marked as required 

•  YQL Compiler validates existence of required keys  

Page 65: Diving Into The Yahoo Open Stack @ SF PHP Meetup

OAuth Endpoint •  hXp://query.yahooapis.com/v1/yql?q=... 

Public Endpoint  •  hXp://query.yahooapis.com/v1/public/yql?q= 

YQL Console  •  hXp://developer.yahoo.com/yql/console 

YQL – API End Points 

Page 66: Diving Into The Yahoo Open Stack @ SF PHP Meetup

66 

ProjecOon ‐ SELECT what FROM table ‐ SELECT * FROM social.connecOons 

Local and Remote Filtering ‐ SELECT what FROM table WHERE filter ‐ SELECT * FROM social.profile WHERE guid = me 

Sub‐selects ‐ Joining Data ‐ SELECT what FROM table WHERE fieldvalue IN (SELECT ...) ‐ SELECT * FROM social.profile WHERE guid   IN (SELECT guid FROM social.connecOons WHERE owner_guid=me) 

Local Paging Control ‐ SELECT what FROM table WHERE filter LIMIT 10 OFFSET 50 ‐ SELECT * FROM web.search WHERE query="madonna" LIMIT 3 OFFSET 10 

Remove Table Size Control ‐ SELECT what FROM table(0,500) WHERE condiOon ‐ SELECT * FROM web.search(0,10) WHERE query="madonna" AND result.XXX = something 

YQL – Query Formats 

Page 67: Diving Into The Yahoo Open Stack @ SF PHP Meetup

67 

YQL – Running a Query with YOS SDK 

Page 68: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YQL + PIPES 

Page 69: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  select * from social.connecOons 

•  select * from delicious.feeds.popular 

•  select * from flickr.photos.interesOngness 

•  select * from friendfeed.status 

•  select * from github.checkins 

YQL ‐ Examples 

Page 70: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Y! Open Stack – Applica>on Pladorm 

•  Allows developers to deploy their own web based applica>ons on Yahoo!  

•  Mul>ple Views: Small and Canvas 

•  Social Context: the new Yahoo! Social Directory 

•  OpenSocial 0.8 Javascript APIs 

Page 71: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Y! Open Stack – Open Applica>ons 

Page 72: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 73: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 74: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 75: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 76: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 77: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 78: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 79: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 80: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 81: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 82: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 83: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 84: Diving Into The Yahoo Open Stack @ SF PHP Meetup

84 

Open Applica>on Code Dive 

 What can you do with open apps? 

Page 85: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 86: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 87: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 88: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 89: Diving Into The Yahoo Open Stack @ SF PHP Meetup

What is YML? 

•  YML tags make it easy for you to create applica>ons that access social data, such as a list of the user’s friends. 

•  Similar in format to XML, YML provides func>onality to Open Applica>ons in a safe and standardized fashion. yml:friend‐selector yml:visible‐to‐friends 

•  Will begin integra>ng into OSML 

Page 90: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YML Tags (Large View) 

yml:a yml:ad yml:audio yml:form yml:friend‐selector yml:if‐env yml:message yml:name yml:profile‐pic yml:pronoun yml:share yml:swf yml:user‐badge   

YML Lite Tags (Small View) 

yml:a yml:audio yml:form yml:if‐env yml:name yml:profile‐pic yml:pronoun yml:user‐badge 

YML Tags 

Page 91: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja is a JavaScript sandbox of sorts.  It saniOzes JavaScript and HTML, removing unsafe code.  That code then runs in the browser.  This allows Yahoo to safely include externally 

created JavaScript.  Developers should expect that they cannot do everything they would 

normally do in a web applicaOon. 

Caja – What is it?

Page 92: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Y! Open Stack – Caja 

•  HTML / CSS / JavaScript securer 

•  Enforces standards 

•  One of the first to integrate Caja (and keep it running) 

•  hXp://code.google.com/p/google‐caja 

•  hXp://developer.yahoo.com/yap/guide/caja‐support.html 

Page 93: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  Caja prevents the use of arbitrary AcOveX components, use of eval and iframes. 

•  External libraries like YUI are not supported. •  It does not allow document.write but innerHTML is allowed. 

•  Objects in Caja cannot be extended by use of obj.prototype. 

•  No direct access to real global objects. 

Caja – What is it?

Page 94: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja – JavaScript Before Cajoling 

Page 95: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja – JavaScript Amer Cajoling 

Page 96: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja & JavaScript – What doesn’t work? •  eval() 

•  new FuncOon() 

•  Strings as event handlers (node.onclick = '...';) 

•  Names ending with double / triple underscores 

•  with funcOon (with (obj) { ... }) 

•  Implicit global variables (specify var variable) 

•  Calling a method as a funcOon 

•  document.write  

•  window.event 

•  .onclick 

•  OpenSocial gadgets.io.makeRequest return JS 

Page 97: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja & HTML – What doesn’t work? •  name aXributes with gadgets.io.makeRequest 

•  Custom aXributes 

•  Custom tags 

•  Unclosed tags 

•  <embed> 

•  <iframe> 

•  <link rel=‘… 

•  javascript:void(0)  •  Radio buXons in IE 

•  RelaOve url’s 

Page 98: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja & IFRAME – Concerns

IFrame Concerns 

•  Drive‐by downloads 

•  Phishing aXacks 

•  No real content restricOons 

Caja Implementa>on 

•  Blacklist all / Whitelist some model 

Page 99: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja & CSS – What doesn’t work? •  * hacks 

•  _ hacks 

•  IE condiOonals 

•  Insert‐aker clear fix 

•  expression() 

•  @import 

•  Background images in IE 

Page 100: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja – Best Prac>ces 

•  Use OpenSocial JavaScript standards •  Use W3C standards 

•  Use YML wherever possible 

•  Unit test all JavaScript •  Read the documentaOon (hXp://developer.yahoo.com/yos) 

•  ParOcipate in the forums (hXp://developer.yahoo.net/

forum/) 

Page 101: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja Prac>cal – Running an AJAX Request 

Page 102: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja Prac>cal – Working with JSON 

Page 103: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja Prac>cal – Assigning Click Handlers 

•  Caja client side saniOzer strips JavaScript when 

inserted in DOM following AJAX requests 

•  How do I assign click handlers then? 

Given: DOM Node with an ID 

<div id=‘myClickDiv’>Click Me!</div> 

Page 104: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja Prac>cal – Assigning Click Handlers 

Page 105: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Caja Prac>cal – Assigning Click Handlers 

Step 2 – Define your callback func>on 

Page 106: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Y! Open Stack – SDKs 

PHP SDK Currently Available Open and OAuth Applica>ons 

Ac>onScript 3 SDK Currently Available Open Applica>ons 

Java SDK in Development Open and OAuth Applica>ons 

Page 107: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Installing the YOS PHP SDK 

1.  Download the SDK

–  http://developer.yahoo.com/social/sdk

2.  Unzip yos_php_sdk-1.1

3.  Get a Developer Key

–  http://developer.yahoo.com/dashboard

4.  Start to write some code 

Page 108: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YOSSDK – Methods 3‐Legged OAuth 

getSessionedUser    (session) getOwner                        (session) getUser                           (session) query                               (session) getPresence                    (user) setPresence                    (user) listUpdates                      (user) listConnecOonUpdates    (user) insertUpdate                   (user) deleteUpdate                  (user) loadProfile                      (user) getConnecOons              (user) getContacts                    (user) setSmallView                 (user) 

2‐Legged OAuth 

setSmallView    (applicaOon) query             (applicaOon)         

Page 109: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YOSSDK – 2‐Legged OAuth 

Used For: 

‐  Public user data and open APIs 

Page 110: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YOSSDK – 3‐Legged OAuth 

Used For: 

‐  Private data access 

Page 111: Diving Into The Yahoo Open Stack @ SF PHP Meetup

<?php // Include the PHP SDK for YSP library. require_once("yosdk/lib/Yahoo.inc"); 

// Define values for keys required for authoriza>on define(CONSUMER_KEY,"dj0yJmk9ZDNwaXdQSEZ…j"); define(CONSUMER_SECRET,"37fe717538e0598e6c70d4262…"); 

// The YahooApplica>on class is used for two‐legged authoriza>on, which doesn't need user authoriza>on. $two_legged_app = new YahooApplica>on(CONSUMER_KEY,CONSUMER_SECRET); 

// Create queries for Flickr $yql_request = 'select * from flickr.photos.search where user_id="28569531@N00" and text="jump" limit 6'; 

// Make the request $results = $two_legged_app‐>query($yql_request); $photos = $results‐>query‐>results‐>photo; 

// Build the output HTML foreach($photos as $k=>$v) {      $imgs .= '<img src="h3p://farm' . $v‐>farm . '.sta>c.flickr.com/' . $v‐>server . '/' . $v‐>id . '_' . $v‐>secret . '_m.jpg" alt="Image' . $k . '"/>' ; } echo "<html><body>" . $imgs . '</body></html>’; ?> 

Page 112: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 113: Diving Into The Yahoo Open Stack @ SF PHP Meetup

<?php // Include the PHP SDK for YSP library. require_once("yosdk/lib/Yahoo.inc"); 

// Define values for keys required for authorizaOon define(CONSUMER_KEY,"dj0yJmk9ZDNwaXd…j"); define(CONSUMER_SECRET,"37fe717538e0598e6…"); 

$session=YahooSession::requireSession(CONSUMER_KEY,CONSUMER_SECRET); 

// Define YQL queries for the Social Directory APIs $query = "SELECT * FROM social.connecOons WHERE owner_guid=me LIMIT 2"; $result = $session‐>query($query); 

// Build the output HTML echo("<html><body><pre><h2>ConnecOon Data</h2>" ); var_dump($result) ; echo("</pre></body></html>"); ?> 

YOSSDK – Finding connec>ons 

Page 114: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YOSSDK – Crea>ng an update 

3‐Legged OAuth 

Page 115: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YOSSDK – Se�ng the status of a user 

3‐Legged OAuth 

Page 116: Diving Into The Yahoo Open Stack @ SF PHP Meetup

YOSSDK – Upda>ng the small view 

Page 117: Diving Into The Yahoo Open Stack @ SF PHP Meetup

117 

Open App Code Dive  Lets build a social app live  

Page 118: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Experience:  Basic Web Dev Knowledge – PHP/HTML/CSS/Javascript 

What we are building: Common ground –  Find out what you have in common with your social graph: music, movies, books, hobbies. 

What we will use: YOSSDK, YQL, YAP 

Building an Open App : CommonGround 

Page 119: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 120: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 121: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  Scalable HosOng –  Joyent – Free OpenSocial Accelerators – Google App Engine – Amazon EC2 + S3 

•  Framework – PHP (symfony) 

– Python (Django) – Ruby (Rails) 

Open Apps – A good founda>on 

Page 122: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  How to work with the YOS SDK •  Using social apis through YQL •  Using any web data through YQL apis •  Displaying social data with YML and YAP 

What will we learn? 

Page 123: Diving Into The Yahoo Open Stack @ SF PHP Meetup

1.  Create an applicaOon in developer dashboard 2.  Set applicaOon URL in developer tool 3.  Build applicaOon 4.  Preview in developer tool 5.  Push live in developer tool 

Five steps to an Open App 

Page 124: Diving Into The Yahoo Open Stack @ SF PHP Meetup

h3p://developer.yahoo.com/dashboard 

Page 125: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 126: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 127: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 128: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 129: Diving Into The Yahoo Open Stack @ SF PHP Meetup

CommonGround available on GitHub 

h3p://github.com/dwhi3le/commonground 

Page 130: Diving Into The Yahoo Open Stack @ SF PHP Meetup

My Apps + Featured ApplicaOons 

Page 131: Diving Into The Yahoo Open Stack @ SF PHP Meetup
Page 132: Diving Into The Yahoo Open Stack @ SF PHP Meetup

Ge�ng Started ‐ Documenta>on Y!OS Main Overview ‐ 

hXp://developer.yahoo.com/yos YAP Main Overview ‐ 

hXp://developer.yahoo.com/yap YQL Docs ‐ 

hXp://developer.yahoo.com/yql YML Docs ‐ 

hXp://developer.yahoo.com/yap/yml  YDN Forum –        hXp://developer.yahoo.com/forum YAP Dashboard ‐ 

hXp://developer.yahoo.com/dashboard 

YQL Console ‐ hXp://developer.yahoo.com/yql/console  

ApplicaOon Gallery ‐ hXp://apps.yahoo.com/myapps 

JSLint ‐ hXp://www.jslint.com 

PHP SDK ‐ hXp://developer.yahoo.com/social/sdk/ 

AS3 SDK ‐ hXp://developer.yahoo.com/flash/yos/ 

Caja ‐ hXp://code.google.com/p/google‐caja/  

Caja Support ‐ hXp://developer.yahoo.com/yap/guide/caja‐support.html  

Page 133: Diving Into The Yahoo Open Stack @ SF PHP Meetup

133 

Open Apps Code Dive  Common Ques>ons  

Page 134: Diving Into The Yahoo Open Stack @ SF PHP Meetup

•  I have an exisOng OpenSocial applicaOon.  How do I get started? 

•  I have an exisOng Facebook applicaOon.  How do I get started? 

•  Can I put ads in my applicaOon? 

•  How do I authenOcate OAuth using JavaScript?  

•  None of my styles are displaying, what’s happening? 

•  Why PHP / AS3 for the first SDK? 

•  setSmallView is not working?  What’s going on? 

•  How do users find my applicaOon? 

Page 135: Diving Into The Yahoo Open Stack @ SF PHP Meetup

QUESTIONS? (I will be around for the whole event, so please do say hello and ask quesOons) 

Page 136: Diving Into The Yahoo Open Stack @ SF PHP Meetup

WANT TO JOIN YAHOO? WE ARE HIRING AND HAVE INTERNSHIPS! 

Page 137: Diving Into The Yahoo Open Stack @ SF PHP Meetup

DEVELOPER.YAHOO.COM EXAMPLES | TUTORIALS | CODE SAMPLES 

ENJOY THE REST OF SF PHP MEETUP