Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 32 lines (26 sloc) 1.043 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<?php
require_once 'lib/OAuth/OAuth.php';
require_once 'lib/Yahoo/YahooOAuthApplication.class.php';
 
//define application key constants
define("CONSUMER_KEY", "KEY HERE");
define("SHARED_SECRET", "KEY HERE");
define("APP_ID", "APPID HERE");

//create 3-legged OAuth request
$oauthapp = YahooOAuthApplication::fromYAP(CONSUMER_KEY, SHARED_SECRET, APP_ID);

//make request to YQL to get relationships for current user
//will return guid, uri and categories for each
$response = $oauthapp->getRelationships();

//for each relationship, obtain the profile and display
foreach ($response->relationsWithCategories->relations->relation as $relation){
    //get guid of the current relation & then profile using the guid
    $guid = $relation->guid;
    $profile = $oauthapp->getProfile($guid);
    
    echo "<h1>Profile: {$profile->profile->nickname}</h1>";
    
    //for each profile, display all profile elements
    foreach ($profile->profile as $key => $value){
        echo "$key: ";
        print_r($value);
        echo '<br />';
    }
}
?>
Something went wrong with that request. Please try again.