VimeoUploadException [0]:无法获取上传票证

时间:2014-12-02 17:48:23

标签: php vimeo-api

Vimeo PHP API与Pro Vimeo帐户一起使用。

我有一个带有文件输入的PHP表单,用户通过表单上传文件,我希望它上传到我们的Vimeo帐户。查看文档我有以下内容:

// via https://developer.vimeo.com/apps/XXXXXX#authentication
// access_token has been generated with "public private purchased create edit delete interact upload" scope
$lib = new \Vimeo\Vimeo($config['client_id'], $config['client_secret'], $config['access_token']);

// send to the API library
$uri = $lib->upload($_FILES['file']['tmp_name']);

// get the info about it so we can find the link
$video_data = $lib->request($uri);

// pull the link out of successful data responses.
$link = '';
if($video_data['status'] == 200)
{
    $link = $video_data['body']['link'];
}

调用Vimeo\Exceptions\VimeoUploadException [ 0 ]: Unable to get an upload ticket.时会抛出$this->perform_upload($file_path, $ticket);

private function perform_upload($file_path, $ticket)
{
    if ($ticket['status'] != 201) {
        throw new VimeoUploadException('Unable to get an upload ticket.');
    }

$ ticket响应为空:

Array ( [body] => [status] => 0 [headers] => Array ( ) )

$curl_info值:

Array
(
    [url] => https://api.vimeo.com/me/videos
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.094
    [namelookup_time] => 0
    [connect_time] => 0.094
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => -1
    [starttransfer_time] => 0
    [redirect_time] => 0
    [certinfo] => Array
        (
        )

    [primary_ip] => xxxxxxxxxxxxx
    [primary_port] => xxx
    [local_ip] => xxxxxxxxx
    [local_port] => xxxxxxx
    [redirect_url] => 
)

我做错了什么?

1 个答案:

答案 0 :(得分:0)

您需要在应用详情页面中发送上传访问请求,并等待Vimeo的接受。