예제 #1
0
<?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 />';
    }
}
예제 #2
0
 *   furnished to do so, subject to the following conditions:
 *
 *   The above copyright notice and this permission notice shall be included in
 *   all copies or substantial portions of the Software.
 *
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *   THE SOFTWARE.
 **/
require_once dirname(__FILE__) . '/common.inc.php';
try {
    $oauthapp = YahooOAuthApplication::fromYAP(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_APP_ID);
} catch (YahooOAuthApplicationException $e) {
}
?>

<style type="text/css">
div#ydoc {
  display: block;
  font-size: 100%;
  font-family: "Calibri", "Lucida Grande", "Tahoma", Arial;
  text-align: left;
  vertical-align: middle;
  color: #000;
  background-color: #fff;
  margin: 0;
  padding: 0;