我想通過CURL上傳一部電影到Wistia API(http://wistia.com/doc/upload-api)。PHP Curl - Wistia API上傳
它使用下面的命令行工作正常,但是當我把它放在PHP代碼,我只是得到一個空白屏幕無反應:
$ curl -i -d "api_password=<YOUR_API_PASSWORD>&url=<REMOTE_FILE_PATH>" https://upload.wistia.com/
PHP代碼:
<?php
$data = array(
'api_password' => '<password>',
'url' => 'http://www.mysayara.com/IMG_2183.MOV'
);
$chss = curl_init('https://upload.wistia.com');
curl_setopt_array($chss, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_POSTFIELDS => json_encode($data)
));
// Send the request
$KReresponse = curl_exec($chss);
// Decode the response
$KReresponseData = json_decode($KReresponse, TRUE);
echo("Response:");
print_r($KReresponseData);
?>
謝謝。
1.你打開'display_errors'? 2. php.ini中的上傳文件大小和文章大小限制是什麼? 3.你甚至不檢查'curl_exec'結果。 – Raptor 2014-09-02 03:30:29