我正在为客户端将 Vimeo PHP 库https://github.com/vimeo/vimeo-php-lib移植到 ColdFusion,并且已经成功地能够翻译除视频上传 POST 请求之外的所有内容。PHP 库使用 cURL,如下所示:
$参数 = 数组(
'oauth_consumer_key' => $this->_consumer_key,
'oauth_token' => $this->_token,
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_timestamp' => 时间(),
'oauth_nonce' => $this->_generateNonce(),
'oauth_version' => '1.0',
'ticket_id' => $ticket,
'chunk_id' => $i
);
// 生成 OAuth 签名
$params = array_merge($params, array(
'oauth_signature' => $this->_generateSignature($params, 'POST', self::API_REST_URL),
'file_data' => '@'.$chunk['file'] // 不要在签名中包含文件
));
// 发布文件
$curl = curl_init($endpoint);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
$rsp = curl_exec($curl);
curl_close($curl);