我想通过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