<?php
$url = "https://famos-ps.bmw.com/FAMOS/services/StatusService";
$password = "xxx";
$username = "xxx";
$product = "xxx";
$request =
'<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header></soap:Header>
<soap:Body>
<request xsi:noNamespaceSchemaLocation="http://www.evolutionfunding.com/dev/calculator/rv/RValue-Request.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<rvaluerequest>
<broker>
<dealeridentifier>identifier</dealeridentifier>
<salesusername>username</salesusername>
<brokerreference></brokerreference>
</broker>
<productcode>PCP01</productcode>
<newvehicle>
<capcode>BM1S2018E2VPIM</capcode>
<annualmileage>12000</annualmileage>
<term>24</term>
</newvehicle>
</rvaluerequest>
</request>
</soap:Body>
</soap:Envelope>';
$response = post_url ($url, $request, $username, $password );
print_r ( $response );
function post_url($url, $data, $username = null, $password = null, $soap_action = 'https://famos-ps.bmw.com/FAMOS/services/StatusService', $timeout = 200) {
$headers = array(
"POST /FAMOS/services/StatusService HTTP/1.0",
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"SOAPAction: \"$data\"",
"Content-length: ".strlen($data),
);
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_TIMEOUT, ( int ) $timeout );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
curl_setopt($ch, CURLOPT_HEADER, 1);
$xmlResponse = curl_exec ( $ch );
$ch_info=curl_getinfo($ch);
curl_close($ch);
print_r($ch_info);
return $xmlResponse;
}
?>