Q:

PHP - cUrl 200 ok, but blank page and response

thank you for your time.
I'm attempting to connect to an API and send some information. I get a 200 Ok but the page is blank and no reporting of errors, Here is my code.
 <?php
error_reporting(E_ALL);

//estructura del xml a enviar (Nota de venta)
    $xml="<?xml version='1.0' encoding='utf-8'?>
<Comprobante sistema='ECOPIPO' rfcEmisor='ECO151106ED3' sucursal='Matriz'
permiteAgregarProductosNoInv='0' folioAutofacturacion='1111111111' formaDePago='01'
observacion='Prueba POST' referencia='Desde POST' subtotal='1000' descuento='0' porcentajeIVA='16'
montoIVA='160' total='1160' monedaSinube='MXN' difZonaHoraria='-5'>
<Receptor rfc='AAA010101AAA' razonSocial='Prueba Nota Venta' esPersonaFisica='0'/>
<Conceptos>
<Concepto productoSinube='PROD001' descripcion='Producto de prueba' cantidad='1' unidadSinube='PZA'
valorUnitario='1000' descuento='0' tipoIVA='Causa IVA' montoBaseIVA='1000' montoIVA='160'
importe='1000' subtotalDet='1000'/>
</Conceptos>
</Comprobante>";

   //primeros 5 parámetros
   $parametro1  = "tipo=7"."\n";
   $parametro2  = "emp=RFC"."\n";
   $parametro3  = "suc=Matriz"."\n";
   $parametro4  = "usu=COTABLE"."\n";
   $parametro5  = "pwd=M7HBEQ6A"."\n";
   $parametro6  = "zh=-6"."\n";

  //parámetros encriptados
    $parametros= base64_encode(utf8_encode($parametro1.$parametro2.$parametro3.$parametro4.$parametro5.$parametro6));
    $url='http://ep.facturanube.appspot.com/blob?par='.$parametros; //url con parámetros encriptados

     //se configura el header tipo xml
  $header = array('Content-Type: text/xml','application/xml;charset=UTF-8','application/x-www-form-urlencoded','Content-length: ' . strlen($xml));
  $connection = curl_init();
  curl_setopt($connection, CURLOPT_URL, $url);
  curl_setopt($connection, CURLOPT_HTTPHEADER, $header);
  curl_setopt($connection, CURLOPT_POST, true);
  curl_setopt($connection, CURLOPT_POSTFIELDS,$xml);//le mando el xml
  curl_setopt($connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($connection, CURLOPT_CONNECTTIMEOUT, 40000);
$output = curl_exec($connection);
  if(curl_errno($connection)){
        print curl_error($connection);
    }
  print_r(curl_getinfo($connection));
    curl_close($connection);
   return $output; //imprimo la nota de venta

    $prueba = 'Probando chingadera';
    echo $prueba;

?>

I'm getting a blank page, i have tried a lot of variations but nothing seems to work, this is the closest i have been to  getting something done.
Also, i'm seeing that nothing runs after connection ends. I cannot see the other thing's i have echoed
I'm starting to think this is not going to work. If you could please check my code to see what errors i have i would really appreciate it.
Thank you

A:

Thank you for your help. I saw what the problem was, it was directly in my xml file, it didn't get the required parameters. I changed that but what allowed me to do so, was to print the output before the curl ended, like this:
 $output = curl_exec($connection);
 echo $output;

I really appreciate your help

