mercredi 22 novembre 2017

post image to webservice using cURL in laravel

I want post $data and $fileData to the webservice using cURL

Any one can help.

This is my code :

$data = $request->bodyData;
$fileData = image file;

$postfields = array();
$postfields['data'] = $data;
$postfields['fileData'] = $fileData;


 $ch = curl_init();

 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $output = curl_exec($ch);

 curl_close($ch);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire