<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<ApiKey>xxxxxxxxxxxxx</ApiKey>
<Data xsi:type="Subscriber">
<Mode>mode</Mode>
<Force>false</Force>
<ListId>1</ListId>
<Email>test@test.ru</Email>
<Firstname>testName</Firstname>
</Data>
</ApiRequest>
$mail="user@mail.ru";
$name="user";
$optional_headers = null;
$url='http://mysite.com/api';
$data='<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"><ApiKey>xxx</ApiKey><Data xsi:type="Subscriber"><Mode>AddAndUpdate</Mode><Force>false</Force><ListId>1</ListId><Email>'.$mail.'</Email><Firstname>'.$name.'</Firstname></Data></ApiRequest>';
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://url/url/url" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, "body goes here" );
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
$result=curl_exec ($ch);