If server-side code is an option, you can use a custom php CURL script as an intermediary to redirect your request to a third party in actual XML format. I'm not sure that CURL comes with a standard php installation, and if this is not an option, you can most likely use fsocketopen (although I personally find this tactic more complicated). But CURL is simple enough to install and extremely useful for basically allowing php to send requests as if it were a browser. The difference that you might be interested in here is that it really allows you to set the heading "Content Type: text / xml".
So your html form will send some regular GET or POST values ββto your php script. Then have your personal PHP script convert them to the XML format expected by a third party. (Remember to use the <?xml version="1.0" encoding="ISO-8859-1"?> Tag with any attribute values ββsuitable for you.) Then send it using this code:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-type: text/xml', 'Content-length: '.strlen($xmlRequest), )); $output = curl_exec($ch); curl_close($ch);
Claymore
source share