Proper way to send (POST) xml with guzzle 6
This is what worked for me on Guzzle 6:
// configure options
$options = [
'headers' => [
'Content-Type' => 'text/xml; charset=UTF8',
],
'body' => $xml,
];
$response = $client->request('POST', $url, $options);
After some experiments, I have figured it out. Here is my solution in case someone reaches a dead end.
$request = new Request(
'POST',
$uri,
['Content-Type' => 'text/xml; charset=UTF8'],
$xml
);