我现在正在工作vimeo api。我已经通过此链接创建了vimeo api帐户 https://developer.vimeo.com/.And我还在我的vimeo帐户中上传了多个视频。现在我想从我的vimeo帐户基于mu api密钥使用我的php语言上传我上传的所有视频详细信息。我尝试了很多链接。我必须尝试这个链接 https://github.com/vimeo/vimeo-php-lib。但是我遇到了问题。我的索引文件就在那里。我只需要更改索引文件,只更新我的api密钥。
<?php
require_once('vimeo.php');
session_start();
// Create the object and enable caching
$vimeo = new phpVimeo('6418f15fd14988bd412f28e7fdec6a573ad3e4df', 'OiqPWf1W+eLoPioLsJ4Fe2Im7DyFlEDT8zv6c15kqQjxoV0SgJatMzRp+h4bKXWD+ChBYdehRQLxRiNYVSZxnZTohmkzVLVj5JrCtwNwoxNCyK+qWpGLcJs5aN5JMOKT');
$vimeo->enableCache(phpVimeo::CACHE_FILE, './cache', 300);
// Clear session
if ($_GET['clear'] == 'all') {
session_destroy();
session_start();
}
// Set up variables
$state = $_SESSION['vimeo_state'];
$request_token = $_SESSION['oauth_request_token'];
$access_token = $_SESSION['oauth_access_token'];
// Coming back
if ($_REQUEST['oauth_token'] != NULL && $_SESSION['vimeo_state'] === 'start') {
$_SESSION['vimeo_state'] = $state = 'returned';
}
// If we have an access token, set it
if ($_SESSION['oauth_access_token'] != null) {
$vimeo->setToken($_SESSION['oauth_access_token'], $_SESSION['oauth_access_token_secret']);
}
switch ($_SESSION['vimeo_state']) {
default:
// Get a new request token
$token = $vimeo->getRequestToken();
// Store it in the session
$_SESSION['oauth_request_token'] = $token['oauth_token'];
$_SESSION['oauth_request_token_secret'] = $token['oauth_token_secret'];
$_SESSION['vimeo_state'] = 'start';
// Build authorize link
$authorize_link = $vimeo->getAuthorizeUrl($token['oauth_token'], 'write');
break;
case 'returned':
// Store it
if ($_SESSION['oauth_access_token'] === NULL && $_SESSION['oauth_access_token_secret'] === NULL) {
// Exchange for an access token
$vimeo->setToken($_SESSION['oauth_request_token'], $_SESSION['oauth_request_token_secret']);
$token = $vimeo->getAccessToken($_REQUEST['oauth_verifier']);
// Store
$_SESSION['oauth_access_token'] = $token['oauth_token'];
$_SESSION['oauth_access_token_secret'] = $token['oauth_token_secret'];
$_SESSION['vimeo_state'] = 'done';
// Set the token
$vimeo->setToken($_SESSION['oauth_access_token'], $_SESSION['oauth_access_token_secret']);
}
// Do an authenticated call
try {
$videos = $vimeo->call('vimeo.videos.getUploaded');
}
catch (VimeoAPIException $e) {
echo "Encountered an API error -- code {$e->getCode()} - {$e->getMessage()}";
}
break;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Vimeo Advanced API OAuth Example</title>
</head>
<body>
<h1>Vimeo Advanced API OAuth Example</h1>
<p>This is a basic example of Vimeo's new OAuth authentication method. Everything is saved in session vars, so <a href="?clear=all">click here if you want to start over</a>.</p>
<?php if ($_SESSION['vimeo_state'] == 'start'): ?>
<p>Click the link to go to Vimeo to authorize your account.</p>
<p><a href="<?= $authorize_link ?>"><?php echo $authorize_link ?></a></p>
<?php endif ?>
<?php if ($ticket): ?>
<pre><?php print_r($ticket) ?></pre>
<?php endif ?>
<?php if ($videos): ?>
<pre><?php print_r($videos) ?></pre>
<?php endif ?>
</body>
</html>
但是我遇到了一个问题。我不知道我的代码是什么错误。请检查并帮助我。
Warning: scandir(./cache,./cache): The system cannot find the file specified. (code: 2) in D:\xampp\htdocs\vimeo\vimeo.php on line 290
Warning: scandir(./cache): failed to open dir: No such file or directory in D:\xampp\htdocs\vimeo\vimeo.php on line 290
Warning: scandir(): (errno 2): No such file or directory in D:\xampp\htdocs\vimeo\vimeo.php on line 290
Warning: Invalid argument supplied for foreach() in D:\xampp\htdocs\vimeo\vimeo.php on line 291
Notice: Undefined index: clear in D:\xampp\htdocs\vimeo\index.php on line 10
Notice: Undefined index: oauth_access_token in D:\xampp\htdocs\vimeo\index.php on line 18
Notice: Undefined index: oauth_token in D:\xampp\htdocs\vimeo\index.php on line 21
Notice: Undefined index: oauth_access_token in D:\xampp\htdocs\vimeo\index.php on line 26
Notice: Undefined index: oauth_token in D:\xampp\htdocs\vimeo\index.php on line 37
Notice: Undefined index: oauth_token_secret in D:\xampp\htdocs\vimeo\index.php on line 38
Notice: Undefined index: oauth_token in D:\xampp\htdocs\vimeo\index.php on line 42
Vimeo Advanced API OAuth Example
This is a basic example of Vimeo's new OAuth authentication method. Everything is saved in session vars, so click here if you want to start over.
Click the link to go to Vimeo to authorize your account.
http://vimeo.com/oauth/authorize?oauth_token=&permission=write
Notice: Undefined variable: ticket in D:\xampp\htdocs\vimeo\index.php on line 93
Notice: Undefined variable: videos in D:\xampp\htdocs\vimeo\index.php on line 97