<?php
    header('Access-Control-Allow-Origin: *'); 
    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");

    include "vendor/autoload.php";

    use Stenfrank\UBL21dian\Client;
    use Stenfrank\UBL21dian\ClientProd;
    use Stenfrank\UBL21dian\Templates\SOAP\GetStatus;
    use Stenfrank\UBL21dian\Templates\SOAP\GetStatusProd;

    $certificado = str_replace('\\','/',$_POST['certificado']);
    $password = $_POST['pase'];

    if($_POST['ambiente']==0){
        $getstatus = new GetStatus($certificado,$password);
    }else{
        $getstatus = new GetStatusProd($certificado,$password);
    }

    $getstatus->trackId = $_POST['key'];

    $getstatus->sign();

    if($_POST['ambiente']==0){
        $client = new Client($getstatus);
    }else{
        $client = new ClientProd($getstatus);
    }

    echo $client;
?>