Error Sending XML file by CURL to WebServices
<p>I'm trying to send by POST method a XML through of CURL to authenticated webServices, but for some reason the server is rejecting the XML file, me giving me an error 500, however another WebService than by GET method, not have problem. The following code is i'm trying.</p>

<pre><code>  &lt;?php
  $request_xml = "&lt;?xml version=\"1.0\" encoding=\"utf-8\" ?&gt; 
  &lt;FiltroLicitaciones xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"&gt; 
  &lt;CantidadRegistro&gt;10&lt;/CantidadRegistro&gt; 
  &lt;Texto&gt;memo&lt;/Texto&gt; 
  &lt;CodigoRegion xsi:nil=\"true\" /&gt; 
  &lt;CodigoEstado&gt;1&lt;/CodigoEstado&gt; 
  &lt;TipoFecha&gt;FechaPublicacion&lt;/TipoFecha&gt; 
  &lt;FechaDesde&gt;2011-06-01T00:00:00&lt;/FechaDesde&gt; 
  &lt;FechaHasta&gt;2011-08-01T00:00:00&lt;/FechaHasta&gt; 
  &lt;/FiltroLicitaciones&gt;";

  //Initialize handle and set options 
  $username = 'user'; 
  $password = 'pass'; 
  $ch = curl_init();

  curl_setopt($ch, CURLOPT_URL, 'https://www.mercadopublico.cl/movil/licitaciones/porFecha');  
 //curl_setopt($ch, CURLOPT_URL, "http://localhost/server.php"); 
   curl_setopt($ch, CURLOPT_USERPWD, $username.':'.$password); 
   curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); 
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
   curl_setopt($ch, CURLOPT_HEADER, 1); 
   curl_setopt($ch, CURLOPT_TIMEOUT, 4); 
   curl_setopt($ch, CURLOPT_POSTFIELDS, $request_xml);

   $result = curl_exec($ch); 

   curl_close($ch); 

   print_r($result); 

   ?&gt;
</code></pre>

<p>I don't know if will be a error for XML malformed, but server return me a random 500 error with the following header:</p>

<pre><code>HTTP/1.1 500 The server encountered an error processing the request. Please see the      server logs for more details.
Cache-Control: private
Content-Length: 1047
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 30 Jul 2012 23:53:05 GMT
</code></pre>

<p>I did a test in the local server, for see as the data came, the following the result this is:</p>

<pre><code>HTTP/1.1 200 OK 
Date: Mon, 30 Jul 2012 23:41:50 GMT 
Server: Apache/2.2.22 (Fedora) 
X-Powered-By: PHP/5.3.14 
Content-Length: 2450 
Connection: close 
Content-Type: text/html; charset=UTF-8 

Array 
( 
 [GLOBALS] =&gt; Array 
 *RECURSION* 
  [_POST] =&gt; Array 
    ( 
        [&lt;?xml version] =&gt; "1.0" encoding="utf-8" ?&gt; 
        &lt;FiltroLicitaciones xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; 
        &lt;CantidadRegistro&gt;10&lt;/CantidadRegistro&gt; 
        &lt;Texto&gt;memo&lt;/Texto&gt; 
        &lt;CodigoRegion xsi:nil="true" /&gt; 
        &lt;CodigoEstado&gt;1&lt;/CodigoEstado&gt; 
        &lt;TipoFecha&gt;FechaPublicacion&lt;/TipoFecha&gt; 
        &lt;FechaDesde&gt;2011-06-01T00:00:00&lt;/FechaDesde&gt; 
        &lt;FechaHasta&gt;2011-08-01T00:00:00&lt;/FechaHasta&gt; 
        &lt;/FiltroLicitaciones&gt; 
    ) 

[_GET] =&gt; Array 
    ( 
    ) 

[_COOKIE] =&gt; Array 
    ( 
    ) 

[_FILES] =&gt; Array 
    ( 
    ) 

[_ENV] =&gt; Array 
    ( 
    ) 

[_REQUEST] =&gt; Array 
    ( 
        [&lt;?xml version] =&gt; "1.0" encoding="utf-8" ?&gt; 
        &lt;FiltroLicitaciones xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; 
        &lt;CantidadRegistro&gt;10&lt;/CantidadRegistro&gt; 
        &lt;Texto&gt;memo&lt;/Texto&gt; 
        &lt;CodigoRegion xsi:nil="true" /&gt; 
        &lt;CodigoEstado&gt;1&lt;/CodigoEstado&gt; 
        &lt;TipoFecha&gt;FechaPublicacion&lt;/TipoFecha&gt; 
        &lt;FechaDesde&gt;2011-06-01T00:00:00&lt;/FechaDesde&gt; 
        &lt;FechaHasta&gt;2011-08-01T00:00:00&lt;/FechaHasta&gt; 
        &lt;/FiltroLicitaciones&gt; 
    ) 

[_SERVER] =&gt; Array 
    ( 
        [HTTP_HOST] =&gt; localhost 
        [HTTP_ACCEPT] =&gt; */* 
        [CONTENT_LENGTH] =&gt; 469 
        [CONTENT_TYPE] =&gt; application/x-www-form-urlencoded 
        [PATH] =&gt; /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 
        [SERVER_SIGNATURE] =&gt; &lt;address&gt;Apache/2.2.22 (Fedora) Server at localhost Port 80&lt;/address&gt; 

        [SERVER_SOFTWARE] =&gt; Apache/2.2.22 (Fedora) 
        [SERVER_NAME] =&gt; localhost 
        [SERVER_ADDR] =&gt; ::1 
        [SERVER_PORT] =&gt; 80 
        [REMOTE_ADDR] =&gt; ::1 
        [DOCUMENT_ROOT] =&gt; /var/www/html 
        [SERVER_ADMIN] =&gt; root@localhost 
        [SCRIPT_FILENAME] =&gt; /var/www/html/server.php 
        [REMOTE_PORT] =&gt; 37712 
        [GATEWAY_INTERFACE] =&gt; CGI/1.1 
        [SERVER_PROTOCOL] =&gt; HTTP/1.1 
        [REQUEST_METHOD] =&gt; POST 
        [QUERY_STRING] =&gt;  
        [REQUEST_URI] =&gt; /server.php 
        [SCRIPT_NAME] =&gt; /server.php 
        [PHP_SELF] =&gt; /server.php 
        [PHP_AUTH_USER] =&gt; user 
        [PHP_AUTH_PW] =&gt; pass 
        [REQUEST_TIME] =&gt; 1343691710 
    ) 
</code></pre>

<p>)</p>

<p>I hope can you help me.</p>

<p>Thanks.</p>

<p>Best Regards.</p>
