-1
我想打印我的OAuth訪問令牌用PHP我得到了我的代碼和庫和 我得到這個錯誤用PHP:類沒有發現
Fatal error: Class 'OAuth2' not found in /home/u490548713/public_html/auth.php on line 13
我的文件是這樣的:
public_html
- GrantType
- AuthorizationCode.php
- ClientCredentials.php
- IGrantType.php
- Password.php
- RefreshToken.php
- Client.php
- auth.php
我的代碼如下所示:
<?php
require('Client.php');
require('GrantType/IGrantType.php');
require('GrantType/AuthorizationCode.php');
const CLIENT_ID = '**';
const CLIENT_SECRET = '***';
const REDIRECT_URI = 'http://*****/****?';
const AUTHORIZATION_ENDPOINT = 'https://beam.pro/oauth/authorize';
const TOKEN_ENDPOINT = 'https://beam.pro/api/v1/oauth/token';
$client = new OAuth2/Client(CLIENT_ID, CLIENT_SECRET);
if (!isset($_GET['code']))
{
$auth_url = $client->getAuthenticationUrl(AUTHORIZATION_ENDPOINT, REDIRECT_URI);
header('Location: ' . $auth_url);
die('Redirect');
}
else
{
$params = array('code' => $_GET['code'], 'redirect_uri' => REDIRECT_URI);
$response = $client->getAccessToken(TOKEN_ENDPOINT, 'authorization_code', $params);
parse_str($response['result'], $info);
echo($info['access_token']);
}
?>
我怎樣才能解決這個問題?
修復它通過查找班 '的OAuth2' – 2016-08-15 01:59:11
的PHP文件中包含的類'OAuth2'? – BeetleJuice
包含OAuth2的filé是Client.php – Checkium