I have a big problem to transform CURL to Http facade in laravel. So I have the code :
$httpParams = [
'textData' => $xml->asXML(),
'xmlFile' => new \CurlFile($params['file']->getPathName())
];
$curlHandle = curl_init('http://url.com');
curl_setopt($curlHandle, CURLOPT_HEADER, false);
curl_setopt($curlHandle, CURLOPT_POST, true);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $httpParams);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$curlResponse = curl_exec($curlHandle);
curl_close($curlHandle);
dump($curlResponse); die();
I have the xml response and status is 200.
Next I using postman (is working just fine), I have response data the xml:
When I try to do with Laravel, I have the status 200 but the response is ""
. I tried multiple ways but still did't work :((
$http = Http::withHeaders([
'Content-Type' => 'multipart/form-data;',
])->withOptions([
'debug' => true,
]);
$httpParams = [
'textData' => $xml->asXML(),
'xmlFile' => new \CurlFile($params['file']->getPathName())
];
dump($http->send('post', $endpoint, $httpParams)->body());die();
Have you an idea how to modify this code in order to works fine with Http facade also ? Thx in advance.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3vvS3W2
via IFTTT
Aucun commentaire:
Enregistrer un commentaire