Пример #1
0
// Include our OAuth functions
require_once 'functions.php';
// Use a session to keep track of temporary credentials, etc
session_start();
// Status variables
$lastError = null;
$currentStatus = null;
// Request dispatching. If a function fails, $lastError will be updated.
if (isset($_GET['action'])) {
    $action = $_GET['action'];
    if ($action == 'requestToken') {
        getTemporaryCredentials();
    } elseif ($action == 'callback') {
        handleCallback();
    } elseif ($action == 'accessToken') {
        getTokenCredentials();
    } elseif ($action == 'listNotebooks') {
        listNotebooks();
    } elseif ($action == 'reset') {
        resetSession();
    }
}
?>

<html>
    <head>
        <title>Evernote PHP OAuth Demo</title>
    </head>
    <body>
        <h1>Evernote PHP OAuth Demo</h1>
Пример #2
0
 */
// Include our configuration settings
require_once 'config.php';
// Include our OAuth functions
require_once 'functions.php';
// Use a session to keep track of temporary credentials, etc
session_start();
// Status variables
$lastError = null;
$currentStatus = null;
// Request dispatching. If a function fails, $lastError will be updated.
if (isset($_GET['action'])) {
    $action = $_GET['action'];
    if ($action == 'callback') {
        if (handleCallback()) {
            if (getTokenCredentials()) {
                listNotebooks();
            }
        }
    } elseif ($action == 'authorize') {
        if (getTemporaryCredentials()) {
            // We obtained temporary credentials, now redirect the user to evernote.com to authorize access
            header('Location: ' . getAuthorizationUrl());
        }
    } elseif ($action == 'reset') {
        resetSession();
    }
}
?>

<html>