c0b142d5eda90d5e85e63ad00c315dfa950b128e
[atutor.git] / docs / mods / _standard / social / lib / OAuth / request_token.php
1 <?php
2 /***********************************************************************/
3 /* ATutor                                                                                                                          */
4 /***********************************************************************/
5 /* Copyright (c) 2002-2010                                             */
6 /* Inclusive Design Institute                                          */
7 /* http://atutor.ca                                                                                                        */
8 /*                                                                                                                                         */
9 /* This program is free software. You can redistribute it and/or           */
10 /* modify it under the terms of the GNU General Public License             */
11 /* as published by the Free Software Foundation.                                           */
12 /***********************************************************************/
13 // $Id$
14
15 require_once('OAuth.php');
16 require_once('../Shindig/ATutorOAuthDataStore.php');
17 $oauthDataStore = new ATutorOAuthDataStore();
18 try {
19   $server = new OAuthServer($oauthDataStore);
20   $server->add_signature_method(new OAuthSignatureMethod_HMAC_SHA1());
21   $server->add_signature_method(new OAuthSignatureMethod_PLAINTEXT());
22   $request = OAuthRequest::from_request();
23   $token = $server->fetch_request_token($request);
24   if ($token) {
25         echo $token->to_string();
26   }
27 } catch (OAuthException $e) {
28   echo $e->getMessage();
29 } catch (Exception $e) {
30   echo $e->getMessage();
31 }
32 ?>