Skip to content
Newer
Older
100644 23 lines (19 sloc) 928 Bytes
fdee58c @jcleblanc new PHP 5 SDK samples for YAP
authored
1 <?php
2 require_once 'lib/OAuth/OAuth.php';
3 require_once 'lib/Yahoo/YahooOAuthApplication.class.php';
4
5 //define application key constants
6 define("CONSUMER_KEY", "KEY HERE");
7 define("SHARED_SECRET", "KEY HERE");
8 define("APP_ID", "APPLICATION ID HERE");
9
10 //create 3-legged OAuth request
11 $oauthapp = YahooOAuthApplication::fromYAP(CONSUMER_KEY, SHARED_SECRET, APP_ID);
12
13 //make request to YQL for current user updates and capture update response object
14 $response = $oauthapp->yql('SELECT loc_longForm, link, description FROM social.updates(100) WHERE guid=me', array('diagnostics' => 'false', 'debug' => 'false'), "GET");
15 $updates = $response->query->results->update;
16
17 //for each update, display the title, description and link
18 for ($i = 0; $i < count($updates) - 1; $i++){
19 $html = "<a href='{$updates[$i]->link}'>{$updates[$i]->loc_longForm}</a>
20 <br />{$updates[$i]->description}<br /><br />";
21 echo $html;
22 }
23 ?>
Something went wrong with that request. Please try again.