I'm trying to send the data in an XML file through to an api using wordpress wp_remote_post. However when I check the response im getting 0 bytes received. I'm not to sure where I've gone wrong but any help would be appreciated. Heres the docs for reference https://help.rmscloud.com/rms-api-technical-information
<?php
$url = 'https://api.rms.com.au/rmsxml/rms_api.aspx';
$xml = 'https://spf.nz/dev/wp-content/themes/yootheme-child/rms.xml';
$args = array(
'method' => 'POST',
'timeout' => 10,
'httpversion' => '1.1',
'headers' => array(
'Authorization' => 'Basic ' . base64_encode( 'demoagent:aREbf2875khu*' ),
'Content-type' => 'application/xml',
'Content-length' => 83
),
'body' => array($xml),
'sslverify' => true
);
$response = wp_remote_post( $url, $args);
if ( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
echo "Something went wrong: $error_message";
} else {
echo 'Response:<pre>';
print_r( $response );
echo '</pre>';
}
?>
XML File:
<RMSPropertyRQ>
<Requests>
<Request>
<AgentId>1</AgentId>
<RMSClientId>3038</RMSClientId>
</Request>
<Request>
<AgentId>1</AgentId>
<RMSClientId>3038</RMSClientId>
</Request>
</Requests>
</RMSPropertyRQ>