0
將Vimeo PHP API與Pro Vimeo帳戶配合使用。VimeoUploadException [0]:無法獲取上傳故障單
我有一個帶有文件輸入的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'];
}
它調用$this->perform_upload($file_path, $ticket);
時拋出Vimeo\Exceptions\VimeoUploadException [ 0 ]: Unable to get an upload ticket.
。
private function perform_upload($file_path, $ticket)
{
if ($ticket['status'] != 201) {
throw new VimeoUploadException('Unable to get an upload 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] =>
)
我在做什麼錯?
您能否提供傳遞到perform_upload的$ ticket的內容?這應該包括一個更明確的錯誤信息。 – Dashron 2014-12-02 19:11:58
@Dashron更新了空票據內容的問題。你認爲這可能是當地的捲曲問題嗎? – xylar 2014-12-03 10:21:05
當然。請查看我們的SSL故障排除評論:https://github.com/vimeo/vimeo.php#troubleshooting – Dashron 2014-12-03 15:37:57