aboutsummaryrefslogtreecommitdiff
path: root/vendor/oauth-php/example/client
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/oauth-php/example/client')
-rw-r--r--vendor/oauth-php/example/client/googledocs.php109
-rw-r--r--vendor/oauth-php/example/client/opera.php125
-rw-r--r--vendor/oauth-php/example/client/twolegged.php67
-rw-r--r--vendor/oauth-php/example/client/twoleggedtest.php78
-rw-r--r--vendor/oauth-php/example/client/twoleggedtwitter.php67
5 files changed, 0 insertions, 446 deletions
diff --git a/vendor/oauth-php/example/client/googledocs.php b/vendor/oauth-php/example/client/googledocs.php
deleted file mode 100644
index 45d66cc..0000000
--- a/vendor/oauth-php/example/client/googledocs.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-
-/**
- * oauth-php: Example OAuth client for accessing Google Docs
- *
- * @author BBG
- *
- *
- * The MIT License
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-
-include_once "../../library/OAuthStore.php";
-include_once "../../library/OAuthRequester.php";
-
-define("GOOGLE_CONSUMER_KEY", "FILL THIS"); //
-define("GOOGLE_CONSUMER_SECRET", "FILL THIS"); //
-
-define("GOOGLE_OAUTH_HOST", "https://www.google.com");
-define("GOOGLE_REQUEST_TOKEN_URL", GOOGLE_OAUTH_HOST . "/accounts/OAuthGetRequestToken");
-define("GOOGLE_AUTHORIZE_URL", GOOGLE_OAUTH_HOST . "/accounts/OAuthAuthorizeToken");
-define("GOOGLE_ACCESS_TOKEN_URL", GOOGLE_OAUTH_HOST . "/accounts/OAuthGetAccessToken");
-
-define('OAUTH_TMP_DIR', function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : realpath($_ENV["TMP"]));
-
-// Init the OAuthStore
-$options = array(
- 'consumer_key' => GOOGLE_CONSUMER_KEY,
- 'consumer_secret' => GOOGLE_CONSUMER_SECRET,
- 'server_uri' => GOOGLE_OAUTH_HOST,
- 'request_token_uri' => GOOGLE_REQUEST_TOKEN_URL,
- 'authorize_uri' => GOOGLE_AUTHORIZE_URL,
- 'access_token_uri' => GOOGLE_ACCESS_TOKEN_URL
-);
-// Note: do not use "Session" storage in production. Prefer a database
-// storage, such as MySQL.
-OAuthStore::instance("Session", $options);
-
-try
-{
- // STEP 1: If we do not have an OAuth token yet, go get one
- if (empty($_GET["oauth_token"]))
- {
- $getAuthTokenParams = array('scope' =>
- 'http://docs.google.com/feeds/',
- 'xoauth_displayname' => 'Oauth test',
- 'oauth_callback' => 'XXXXXXXXXXX');
-
- // get a request token
- $tokenResultParams = OAuthRequester::requestRequestToken(GOOGLE_CONSUMER_KEY, 0, $getAuthTokenParams);
-
- // redirect to the google authorization page, they will redirect back
- header("Location: " . GOOGLE_AUTHORIZE_URL . "?btmpl=mobile&oauth_token=" . $tokenResultParams['token']);
- }
- else {
- // STEP 2: Get an access token
- $oauthToken = $_GET["oauth_token"];
-
- // echo "oauth_verifier = '" . $oauthVerifier . "'<br/>";
- $tokenResultParams = $_GET;
-
- try {
- OAuthRequester::requestAccessToken(GOOGLE_CONSUMER_KEY, $oauthToken, 0, 'POST', $_GET);
- }
- catch (OAuthException2 $e)
- {
- var_dump($e);
- // Something wrong with the oauth_token.
- // Could be:
- // 1. Was already ok
- // 2. We were not authorized
- return;
- }
-
- // make the docs requestrequest.
- $request = new OAuthRequester("http://docs.google.com/feeds/documents/private/full", 'GET', $tokenResultParams);
- $result = $request->doRequest(0);
- if ($result['code'] == 200) {
- var_dump($result['body']);
- }
- else {
- echo 'Error';
- }
- }
-}
-catch(OAuthException2 $e) {
- echo "OAuthException: " . $e->getMessage();
- var_dump($e);
-}
-?> \ No newline at end of file
diff --git a/vendor/oauth-php/example/client/opera.php b/vendor/oauth-php/example/client/opera.php
deleted file mode 100644
index d881c98..0000000
--- a/vendor/oauth-php/example/client/opera.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-
-/**
- * oauth-php: Example OAuth client for accessing my opera
- *
- * @author Ryan
- *
- *
- * The MIT License
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * Request your consumer key/secret here:
- * http://auth.opera.com/service/oauth/applications/
- * Make sure to set the Application callback URL
- *
- * To make this example work change the following files
- *
- * OAuthRequestSigner.php // Opera oAuth doesn't accept twice encoded signature
- * $this->setParam('oauth_signature', $signature, true);
- * to:
- * $this->setParam('oauth_signature', urldecode($signature), true);
- */
-
-include_once "../../library/OAuthStore.php";
-include_once "../../library/OAuthRequester.php";
-
-define("OPERA_CONSUMER_KEY", "---");
-define("OPERA_CONSUMER_SECRET", "---");
-
-define("OPERA_REQUEST_TOKEN_URL", "https://auth.opera.com/service/oauth/request_token");
-define("OPERA_AUTHORIZE_URL", "https://auth.opera.com/service/oauth/authorize");
-define("OPERA_ACCESS_TOKEN_URL", "https://auth.opera.com/service/oauth/access_token");
-
-define('OAUTH_TMP_DIR', function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : realpath($_ENV["TMP"]));
-
-// Start the session
-session_start();
-
-// Init the OAuthStore
-$options = array(
- 'consumer_key' => OPERA_CONSUMER_KEY,
- 'consumer_secret' => OPERA_CONSUMER_SECRET,
- 'server_uri' => 'http://my.opera.com/community/api/',
- 'request_token_uri' => OPERA_REQUEST_TOKEN_URL,
- 'authorize_uri' => OPERA_AUTHORIZE_URL,
- 'access_token_uri' => OPERA_ACCESS_TOKEN_URL
-);
-// Note: do not use "Session" storage in production. Prefer a database
-// storage, such as MySQL.
-OAuthStore::instance("Session", $options);
-
-try
-{
- // STEP 1: If we do not have an OAuth token yet, go get one
- if (empty($_GET["oauth_verifier"]))
- {
- $getAuthTokenParams = array(
- 'oauth_callback'=>'oob'
- );
- $options = array (
- 'oauth_as_header' => false
- );
-
- // get a request token
- $tokenResultParams = OAuthRequester::requestRequestToken(OPERA_CONSUMER_KEY, 0, $getAuthTokenParams, 'POST', $options);
- $_SESSION['oauth_token'] = $tokenResultParams['token'];
-
- // redirect to the opera authorization page, they will redirect back
- header("Location: " . OPERA_AUTHORIZE_URL . "?oauth_token=" . $tokenResultParams['token']);
- }
- else {
- // STEP 2: Get an access token
- try {
- OAuthRequester::requestAccessToken(OPERA_CONSUMER_KEY, $_SESSION['oauth_token'], 0, 'POST', $options=array(
- 'oauth_verifier'=>$_GET['oauth_verifier']
- ));
- }
- catch (OAuthException2 $e)
- {
- var_dump($e);
- // Something wrong with the oauth_token.
- // Could be:
- // 1. Was already ok
- // 2. We were not authorized
- return;
- }
-
- // make the docs requestrequest.
- $request = new OAuthRequester("http://my.opera.com/community/api/users/status.pl", 'GET');
- $result = $request->doRequest(0,array(
- CURLOPT_HTTPHEADER=>array(
- 'Accept: application/json',
- ),
- ));
- if ($result['code'] == 200) {
- var_dump($result['body']);
- }
- else {
- echo 'Error';
- }
- }
-}
-catch(OAuthException2 $e) {
- echo "OAuthException: " . $e->getMessage();
- var_dump($e);
-}
-?>
diff --git a/vendor/oauth-php/example/client/twolegged.php b/vendor/oauth-php/example/client/twolegged.php
deleted file mode 100644
index a22c4fd..0000000
--- a/vendor/oauth-php/example/client/twolegged.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * oauth-php: Example OAuth client
- *
- * Performs simple 2-legged authentication
- *
- * @author Ben Hesketh
- *
- *
- * The MIT License
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-
-include_once "../../library/OAuthStore.php";
-include_once "../../library/OAuthRequester.php";
-
-// Test of the OAuthStore2Leg
-
-$key = '???????'; // fill with your public key
-$secret = '????????'; // fill with your secret key
-$url = "?????????"; // fill with the url for the oauth service
-
-$options = array('consumer_key' => $key, 'consumer_secret' => $secret);
-OAuthStore::instance("2Leg", $options);
-
-$method = "GET";
-$params = null;
-
-try
-{
- // Obtain a request object for the request we want to make
- $request = new OAuthRequester($url, $method, $params);
-
- // Sign the request, perform a curl request and return the results,
- // throws OAuthException2 exception on an error
- // $result is an array of the form: array ('code'=>int, 'headers'=>array(), 'body'=>string)
- $result = $request->doRequest();
-
- $response = $result['body'];
- var_dump($response);
-}
-catch(OAuthException2 $e)
-{
- echo "Exception";
-}
-
-?>
diff --git a/vendor/oauth-php/example/client/twoleggedtest.php b/vendor/oauth-php/example/client/twoleggedtest.php
deleted file mode 100644
index 0fc866b..0000000
--- a/vendor/oauth-php/example/client/twoleggedtest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/**
- * oauth-php: Example OAuth client
- *
- * Performs simple 2-legged authentication
- *
- * @author Ben Hesketh
- *
- *
- * The MIT License
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-
-include_once "../../library/OAuthStore.php";
-include_once "../../library/OAuthRequester.php";
-
-// Test of the OAuthStore2Leg
-// uses http://term.ie/oauth/example/
-
-$key = 'key'; // fill with your public key
-$secret = 'secret'; // fill with your secret key
-$url = "http://term.ie/oauth/example/request_token.php"; // fill with the url for the oauth service
-
-$options = array('consumer_key' => $key, 'consumer_secret' => $secret);
-OAuthStore::instance("2Leg", $options);
-
-$method = "GET";
-$params = null;
-
-try
-{
- // Obtain a request object for the request we want to make
- $request = new OAuthRequester($url, $method, $params);
-
- // Sign the request, perform a curl request and return the results,
- // throws OAuthException2 exception on an error
- // $result is an array of the form: array ('code'=>int, 'headers'=>array(), 'body'=>string)
- $result = $request->doRequest();
-
- $response = $result['body'];
-
- if ($response != 'oauth_token=requestkey&oauth_token_secret=requestsecret')
- {
- echo 'Error! $response ' . $response;
- }
- else
- {
- }
-
-
- var_dump($response);
-}
-catch(OAuthException2 $e)
-{
- echo "Exception" . $e->getMessage();
-}
-
-?>
diff --git a/vendor/oauth-php/example/client/twoleggedtwitter.php b/vendor/oauth-php/example/client/twoleggedtwitter.php
deleted file mode 100644
index 871c2a4..0000000
--- a/vendor/oauth-php/example/client/twoleggedtwitter.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * oauth-php: Example OAuth client
- *
- * Performs simple 2-legged authentication
- *
- * The MIT License
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-
-include_once "../../library/OAuthStore.php";
-include_once "../../library/OAuthRequester.php";
-
-// register at http://twitter.com/oauth_clients and fill these two
-define("TWITTER_CONSUMER_KEY", "FILL THIS");
-define("TWITTER_CONSUMER_SECRET", "FILL THIS");
-
-define("TWITTER_OAUTH_HOST","https://twitter.com");
-define("TWITTER_REQUEST_TOKEN_URL", TWITTER_OAUTH_HOST . "/oauth/request_token");
-define("TWITTER_AUTHORIZE_URL", TWITTER_OAUTH_HOST . "/oauth/authorize");
-define("TWITTER_ACCESS_TOKEN_URL", TWITTER_OAUTH_HOST . "/oauth/access_token");
-define("TWITTER_PUBLIC_TIMELINE_API", TWITTER_OAUTH_HOST . "/statuses/public_timeline.json");
-define("TWITTER_UPDATE_STATUS_API", TWITTER_OAUTH_HOST . "/statuses/update.json");
-
-define('OAUTH_TMP_DIR', function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : realpath($_ENV["TMP"]));
-
-// Twitter test
-$options = array('consumer_key' => TWITTER_CONSUMER_KEY, 'consumer_secret' => TWITTER_CONSUMER_SECRET);
-OAuthStore::instance("2Leg", $options);
-
-try
-{
- // Obtain a request object for the request we want to make
- $request = new OAuthRequester(TWITTER_REQUEST_TOKEN_URL, "POST");
- $result = $request->doRequest(0);
- parse_str($result['body'], $params);
-
- // now make the request.
- $request = new OAuthRequester(TWITTER_PUBLIC_TIMELINE_API, 'GET', $params);
- $result = $request->doRequest();
-}
-catch(OAuthException2 $e)
-{
- echo "Exception" . $e->getMessage();
-}
-
-?> \ No newline at end of file