php cURL - post和echo result:“xml结构错误或编码解码错误...”

I try to post and get result by cURL, with no success yet...

Description-manual of information privider says: "In odder to send request to server you must send POST request with variable xml encoded in base64. Xml variable consist of XML special format. Examle PHP:

   $curl = curl_init();
   curl_setopt($curl, CURLOPT_URL, 'http://test.client-shop-logistics.ru/index.php?route=deliveries/api');
   curl_setopt($curl, CURLOPT_POST, 1);
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($curl, CURLOPT_POSTFIELDS, 'xml='.urlencode(base64_encode($xml)));
   curl_setopt($curl, CURLOPT_USERAGENT, 'Opera 10.00');
   $res = curl_exec($curl);
   curl_close($curl);

Request example:

<request>
  <function>get_order_status_array</function>
  <api_id>API_ID</api_id>
  <deliveries>
    <code>135834675500056751</code>
    <code>135834675500056750</code>
    <code>135833991800056758</code>
  </deliveries>
</request>

Answer example:

<answer>
  <error>0</error>
  <deliveries>
    <delivery>
      <code>135834675500056750</code>
      <order_id>400004</order_id>
      <status>New</status>
      <payment_status/> 
      <vozvrat_status/> 
      <errors/>
      <pickup_id/>
      <oplacheno_poluchatelem>0</oplacheno_poluchatelem>
      <products>
        <product>
          <articul>4556-56</articul>
          <name>test name</name>
          <quantity>10</quantity>
          <price>1000</price>
          <number_of_return>0</number_of_return>
          <number_of_delivered>0</number_of_delivered>
          <status/>
        </product>
        <product>
          <articul>22229</articul>
          <name>Test product</name>
          <quantity>20</quantity>
          <price>2000</price>
          <number_of_return>0</number_of_return>
          <number_of_delivered>0</number_of_delivered>
          <status/>
        </product>
      </products>
    </delivery>
    <delivery>
      <code>135834675500056751</code>
      <order_id>400003</order_id>
      <status>New</status>
      <payment_status/>
      <vozvrat_status/> 
      <errors/>
      <pickup_id/>
      <oplacheno_poluchatelem>0</oplacheno_poluchatelem> 
      <products>
        <product>
          <articul>22229-22</articul>
          <name>test name</name>
          <quantity>40</quantity>
          <price>4000</price>
          <number_of_return>0</number_of_return>
          <number_of_delivered>0</number_of_delivered>
          <status/>
        </product>
        <product>
          <articul>4556-44</articul>
          <name>test name</name>
          <quantity>30</quantity>
          <price>3000</price>
          <number_of_return>0</number_of_return>
          <number_of_delivered>0</number_of_delivered>
          <status/>
        </product>
      </products>
    </delivery>
    <delivery>
      <code>135833991800056758</code>
      <order_id>600003</order_id>
      <status>Completed</status>
      <payment_status/>
      <errors></errors>
      <pickup_id/>
      <oplacheno_poluchatelem>0</oplacheno_poluchatelem>
    </delivery>
  </deliveries>
</answer>

Here is my testing php file (testcurl.php which I try to run from my site) using testing api_id / url:

<?php

// build xml        
$xml = '
<?xml version="1.0" encoding="UTF-8"?>
<file>
<request>
  <function>get_order_status_array</function>
  <api_id>577888574a3e4df01867cd5ccc9f18a5</api_id>
  <deliveries>
    <code>135834675500056751</code>
    <code>135834675500056750</code>
    <code>135833991800056758</code>
  </deliveries>
</request>
</file>';

       $curl = curl_init();
       curl_setopt($curl, CURLOPT_URL, 'https://test.client-shop-logistics.ru/index.php?route=deliveries/api');
       curl_setopt($curl, CURLOPT_POST, 1);
       curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
       curl_setopt($curl, CURLOPT_POSTFIELDS, 'xml='.urlencode(base64_encode($xml)));
       curl_setopt($curl, CURLOPT_USERAGENT, 'Opera 10.00');
       $res = curl_exec($curl);
       curl_close($curl);

       echo $res;

?>

Finally I get an error: "Error in structure xml or wrong encoded decoded: get_order_status_array 577888574a3e4df01867cd5ccc9f18a5 135834675500056751 135834675500056750 135833991800056758"

What I am missing?