Executing this curl command from terminal is working and i am getting back my results.
curl -F "file=@/var/www/html/uploads/fb5bc34e1f0f03c759e92010f6a1a302_modified.csv" http://10.0.0.106:8089/uploadAndMatch/ -o ~/out.txt
But when trying it from PHP with the following code I am getting 400 httpcode:
$request = curl_init('http://10.0.0.106:8089/uploadAndMatch/');
curl_setopt($request, CURLOPT_POST, true);
curl_setopt($request,
CURLOPT_POSTFIELDS,
array(
'file' => '@/var/www/html/uploads/fb5bc34e1f0f03c759e92010f6a1a302_modified.csv'
));
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
$httpcode = curl_getinfo($request, CURLINFO_HTTP_CODE);
echo $httpcode;
curl_close($request);
I also tried to add a header :
$header = array('Content-Type: multipart/form-data');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
But it's still the same error! 400 bad request
Any thoughts?
It wasn't a debugging problem, it's because the changes in php5.5+