I am converting a blade file of laravel into pdf and then I want to upload this file to the 3rd party url (Signow).While I am hitting the curl URL from my api then that 3rd part api giving me error of please upload file though I am sending file.
I had tried the below code
$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/a16100bbc5b188d5eff47c5d0f0ad44d45f199fa');
// 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 1d5e9477cc7aff5f82762274cb70d2af69811cefca6019267827a03e6c3ae3a8",
"Cache-Control: no-cache"
));
// output the response
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
// close the session
curl_close($request);
I want to know whats mistake in my CURL Call (because I am already sending file yet 3rd party api giving error of please upload file)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire