示例#1
0
文件: callback.php 项目: moinax/miso
<?php

include __DIR__ . '/settings.php';
include __DIR__ . '/../src/Moinax/Miso/Client.php';
use Moinax\Miso\Client;
session_start();
$miso = new Client(MISO_OAUTH_TOKEN, MISO_OAUTH_TOKEN_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
if ($oauthToken = $_GET['oauth_token']) {
    $miso->setToken($oauthToken, $_SESSION['miso']['token_secrect']);
    $access_token_info = $miso->getAccessToken(Client::MISO_ACCESS_TOKEN_URL);
    $_SESSION['miso']['token'] = $access_token_info['oauth_token'];
    $_SESSION['miso']['token_secret'] = $access_token_info['oauth_token_secret'];
    header('Location: http://localhost/Miso/examples/index.php');
    exit(0);
}
exit(1);
示例#2
0
文件: index.php 项目: moinax/miso
<?php

include __DIR__ . '/settings.php';
include __DIR__ . '/../src/Moinax/Miso/Client.php';
use Moinax\Miso\Client;
session_start();
$miso = new Client(MISO_OAUTH_TOKEN, MISO_OAUTH_TOKEN_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
if (!isset($_SESSION['miso']['token'])) {
    $request_token_info = $miso->getRequestToken(Client::MISO_REQUEST_TOKEN_URL, MISO_OAUTH_CALLBACK);
    $_SESSION['miso']['token_secret'] = $request_token_info['oauth_token_secret'];
    header('Location: ' . Client::MISO_AUTHORIZE_URL . '?oauth_token=' . $request_token_info['oauth_token']);
    exit(0);
}
$miso->setToken($_SESSION['miso']['token'], $_SESSION['miso']['token_secret']);
$user = $miso->getUser();
$favorites = $miso->getFavorites();
$alcatraz = $miso->searchSeries('Alcatraz');