Nov 22, 2017
0
Level 1
post image to webservice using cURL in laravel
$data = $request->bodyData;
$fileData = image file;
I want send $data and $fileData to the webservice using cURL
Any one can help.
This is my code :
$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);
Please or to participate in this conversation.