Mercurial > hg > ywww
comparison goodreads/index.php @ 6:077b0a0a3e6d
remaining originals according to dependency walk
| author | Robert Boland <robert@markup.co.uk> |
|---|---|
| date | Thu, 16 Feb 2017 22:29:02 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 5:55445b456ad0 | 6:077b0a0a3e6d |
|---|---|
| 1 <?php | |
| 2 /** | |
| 3 * @author Sachin Khosla | |
| 4 * @description: This file requests the request token and | |
| 5 * creates the authorization/login link | |
| 6 * Stores the oauth_token in the session variables. | |
| 7 * | |
| 8 * modified by @YourNextRead to integrate with goodreads | |
| 9 */ | |
| 10 | |
| 11 | |
| 12 require_once('GoodreadsAPI.php'); | |
| 13 | |
| 14 session_start(); | |
| 15 | |
| 16 | |
| 17 $connection = new GoodreadsAPI(CONSUMER_KEY, CONSUMER_SECRET); | |
| 18 $request_token = $connection->getRequestToken(CALLBACK_URL); | |
| 19 | |
| 20 | |
| 21 $_SESSION['oauth_token'] = $request_token['oauth_token']; | |
| 22 $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret']; | |
| 23 | |
| 24 $authorize_url = $connection->getLoginURL($request_token); | |
| 25 //echo "token: " . $request_token['oauth_token'] . "\n"; | |
| 26 //echo " secret: " . $request_token['oauth_token_secret']; | |
| 27 | |
| 28 echo "<a href='$authorize_url'>Sign in to <img src='goodreads-badge.png' alt='goodreads' /></a>"; | |
| 29 | |
| 30 ?> |
