0
我嘗試在YouTube上使用API Eden。Youtube API使用Eden PHP庫
http://www.eden-php.com/documentation/social/google/youtube
我阻止了連接。我使用此代碼類似thez說:
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'];
}
我必須把我的dev鍵,身份證,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
Thx!錯誤說我忘了在Wamp中激活php_curl。現在是工作。 – mpgn 2013-05-01 19:33:25