我尝试在 YouTube 上使用 API Eden。
http://www.eden-php.com/documentation/social/google/youtube
我阻止连接。我使用这个代码就像 z 说:
session_start();
$auth = eden('google')->auth('[CLIENT_ID]', '[CLIENT_SECRET]', 'http://yourwebsite.com/auth', '[API_KEY]');
//if no code and no session
if(!isset($_GET['code']) && !isset($_SESSION['token'])) {
//redirect to login
$login = $auth->getLoginUrl('youtube');
header('Location: '.$login);
exit;
}
//Code is returned back from google
if(isset($_GET['code'])) {
//save it to session
$access = $auth->getAccess($_GET['code']);
$_SESSION['token'] = $access['access_token'];
}
我已经把我的开发密钥,id,id_secret ......
但是当我进入新页面并尝试这样放置代码时:
session_start();
include('eden.php');
$youtube = eden('google')->youtube($_SESSION['token'], '[DEVELOPER_KEY]');
标题:
new.php?code=4/wDGcl_A2FePVDPGE42s4p1qGH-mI.wmD1IpIt-OIVOl05ti8ZT3ZN-xDDfAI
我有 :
Notice: Undefined index: token in C:\wamp\www\eden\new.php on line 6