当我尝试使用api的curl来击打https://api.kairos.com/v2/media时,我得到的响应是 “ {”代码“:1002,”消息“:”缺少必需的源参数。“}”
$queryUrl = "https://api.kairos.com/v2/media";
$videoObject = [];
$videoObject['source'] = $request->file('source');
$videoObject['source-filename'] = $request->input('source-filename');
$data = curl_init($queryUrl);
// set curl options
curl_setopt($data, CURLOPT_POST, true);
curl_setopt($data,CURLOPT_POSTFIELDS, json_encode($videoObject));
curl_setopt($data, CURLOPT_HTTPHEADER, array(
"Content-type: application/json",
"app_id:" . $APP_ID,
"app_key:" . $APP_KEY
)
);
curl_setopt($data, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($data);
dd($response);
当我尝试打印$ videoObject时,我可以看到source的值。