2017-07-03 10 views
0

私はここでVimeoのAPIを使用しています: https://github.com/vimeo/vimeo.phpVimeoのPHPのAPI - 認証要求を行う

を、私はこのようにそれを含めました:

// include the autoload file from the vimeo php library that was downloaded 
include __DIR__ . '/vimeo/autoload.php'; 

// The client id and client secret needed to use the vimeo API 
$clientId = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$clientSecret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 

// when getting an auth token we need to provide the scope 
// all possible scopes can be found here https://developer.vimeo.com/api/authentication#supported-scopes 
$scope = array('public', 'private'); 

// initialize the vimeo library 
$lib = new \Vimeo\Vimeo($clientId, $clientSecret); 

// request an auth token (needed for all requests to the Vimeo API) 
$token = $lib->clientCredentials($scope); 

// redirect_uri must be provided, and must match your configured uri 
$token = $lib->accessToken(code, redirect_uri); 

// use the token 
$lib->setToken($token['body']['access_token']); 

それから私はビデオ親指のURLを取得しよう:

$vimeo_response = $lib->request('/videos/218234161/pictures', 'GET'); 

これはちょうどnull値を返します。

この時点でもう何を試していいのか分かりません。

+1

の二つのパラメータ: https://developer.vimeo.com/apps

私はクライアントIDと秘密と一緒にトークンを持っていたら、これだったのコードです'accessToken'メソッドは定数ですか? –

+0

私はそれが働いて、ありがとう! –

答えて

0

私はそれがトークンここでのアクセスを発生させることにより作業になってしまった:

// include the autoload file from the vimeo php library that was 
    include __DIR__ . '/vimeo/autoload.php'; 
    use Vimeo\Vimeo; 

    function get_vimeo_thumb($vimeo_video_id){ 

    // The client id and client secret needed to use the vimeo API 
    $clientId = "XXXXXXXXXXXXXXXXXXXXXXX"; 
    $clientSecret = "XXXXXXXXXXXXXXXXXXXXXXXXX"; 
    $access_token = "XXXXXXXXXXXXXXXXXXXXXXXXX"; 

    //// initialize the vimeo library 
    $vimeo = new Vimeo($clientId, $clientSecret); 

    // Set access token 
    $vimeo->setToken($access_token); 

    $thumb = $vimeo->request("/videos/" . $vimeo_video_id . "/pictures/"); 
    return $thumb['body']['data'][0]['sizes'][2]['link']; 

    } 
関連する問題