Port Vimeo上传PHP POST请求

时间:2012-04-23 16:23:20

标签: php rest oauth vimeo

我正在为客户端移植Vimeo PHP库https://github.com/vimeo/vimeo-php-lib到ColdFusion,并且已经成功地翻译了除视频上传POST请求之外的所有内容。 PHP lib使用cURL,如下所示:


    $params = array(
        'oauth_consumer_key'     => $this->_consumer_key,
        'oauth_token'            => $this->_token,
        'oauth_signature_method' => 'HMAC-SHA1',
        'oauth_timestamp'        => time(),
        'oauth_nonce'            => $this->_generateNonce(),
        'oauth_version'          => '1.0',
        'ticket_id'              => $ticket,
        'chunk_id'               => $i
    );

    // Generate the OAuth signature
    $params = array_merge($params, array(
        'oauth_signature' => $this->_generateSignature($params, 'POST', self::API_REST_URL),
        'file_data'       => '@'.$chunk['file'] // don't include the file in the signature
    ));

    // Post the 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);

1 个答案:

答案 0 :(得分:0)

不确定如何在cfscript中执行此操作,但您可以将文件指定为cfhttpparam。

<cfhttp url="something.com">
<cfhttpparam type="file" file="c:\temp\myfile"/>
</cfhttp>

我错过了什么?