public function curl(){
$file = new \CURLFile('/www/wwwroot/appBackstage/public/unit_task_flow/taskflow_S55773_160519.json');
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://aip.baidubce.com/file/2.0/unit/v3/taskflow/import',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Content-Type: multipart/form-data'
),
CURLOPT_POSTFIELDS =>
array('serviceId' => 'S55773',
'file'=> $file,
'access_token' => '24.535e6595370ef7222aa050b5c115b9b0.2592000.1630742949.282335-24615339'),
));
$response = curl_exec($curl);
curl_close($curl);
var_dump($response);
exit;
}
之前其他途径处理过