Port Vimeo Upload PHP POST Request
I am working on porting the Vimeo PHP library https://github.com/vimeo/vimeo-php-lib to ColdFusion for a client and have successfully been able to translate everything except the video upload POST request. The PHP lib uses cURL like this:
$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);
Not sure how to do it in cfscript but you can specify the file as a cfhttpparam.
<cfhttp url="something.com">
<cfhttpparam type="file" file="c:tempmyfile"/>
</cfhttp>
what am I missing?
链接地址: http://www.djcxy.com/p/35844.html