我正在将laravel的刀片文件转换为pdf,然后将该文件上传到第3方网址(Signow)。当我从我的api中访问curl URL时,然后是第3部分api给了我请错误我正在发送文件,但仍上传文件。
我尝试了以下代码
$data ['test'] = 'test';
$html = view('emails/alarm-nap')->with("post",$data)->render();
$pdf = \App::make('dompdf.wrapper');
$pdf->loadHTML($html);
$pdfs = $pdf->stream();
$request = curl_init('https://api-eval.signnow.com/document/docid');
// send a file
curl_setopt($request, CURLOPT_POST, true);
curl_setopt(
$request,
CURLOPT_POSTFIELDS,
array(
'file' =>
'@' .$pdfs
. ';filename=' ."test"
));
curl_setopt($request,CURLOPT_HTTPHEADER,array(
"Accept: */*",
"Accept-Encoding: gzip, deflate",
"Authorization: Bearer token",
"Cache-Control: no-cache"
));
// output the response
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
// close the session
curl_close($request);
我想知道CURL调用中有什么错误(因为我已经在发送文件了,但是第三方api给出了请上传文件的错误)