How to duplicate a curl XML request using HTTP API?

I tried some more trial and error and managed to get it to work by simply putting $xml as the body without specifying it as an array. The function reference says, “Post data should be sent in the body as an array,” so I’m not sure why it worked.

Here is the working code in case it helps someone else:

// Sends the xml request to the API
$result = wp_remote_post(
    $this->settings['api_url'],
    array(
        'method'      => 'POST',
        'timeout'     => 45,
        'redirection' => 5,
        'httpversion' => '1.1',
        'headers'     => array(
            'Content-Type' => 'text/xml'
        ),
        'body'        => $xml,
        'sslverify'   => 'false'
    )
);