diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/goodreads/index.php	Thu Feb 16 22:29:02 2017 +0000
@@ -0,0 +1,30 @@
+<?php
+/**
+ * @author Sachin Khosla
+ * @description: This file requests the request token and
+ * creates the authorization/login link
+ * Stores the oauth_token in the session variables.
+ *
+ * modified by @YourNextRead to integrate with goodreads
+ */
+
+
+require_once('GoodreadsAPI.php');
+
+session_start();
+
+
+$connection = new GoodreadsAPI(CONSUMER_KEY, CONSUMER_SECRET);
+$request_token = $connection->getRequestToken(CALLBACK_URL);
+
+
+$_SESSION['oauth_token']  = $request_token['oauth_token'];
+$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
+
+$authorize_url = $connection->getLoginURL($request_token);
+//echo "token: " . $request_token['oauth_token'] . "\n";
+//echo " secret: " . $request_token['oauth_token_secret'];
+
+echo "<a href='$authorize_url'>Sign in to <img src='goodreads-badge.png' alt='goodreads' /></a>";
+
+?>
\ No newline at end of file