XML specification

The method of dispatch is always POST

Query headers should always contain

Content-type: text/xml; charset=utf-8;

Encoding of XML documents: UTF-8

The transmitted XML document must not contain any string translations

Line translations in the data itself should be replaced with a /n

Server address for sending requests


Examples of XML transmission

// XML-document
$src = '<?xml version="1.0" encoding="utf-8"?><request><security><login value="login" /><password value="password" /></security></request>';  
// server address
$href = 'http://server/script.php'; 
$res = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml; charset=utf-8'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CRLF, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $src);
curl_setopt($ch, CURLOPT_URL, $href);
$result = curl_exec($ch);
$res = $result;
echo $res;

Last updated