<?php

class alertasRVSPTask extends sfBaseTask {

    protected function configure() {
        // // add your own arguments here
        // $this->addArguments(array(
        //   new sfCommandArgument('my_arg', sfCommandArgument::REQUIRED, 'My argument'),
        // ));

        $this->addOptions(array(
            new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'),
            new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
            new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'),
                // add your own options here
        ));

        $this->namespace = 'radicacionvirtualcuentas';
        $this->name = 'alertas_rvsp';
        $this->briefDescription = '';
        $this->detailedDescription = <<<EOF
The [alertas rvsp|INFO] task does things.
Call it with:

  [php symfony alertas_rvsp|INFO]
EOF;
    }

    protected function execute($arguments = array(), $options = array()) {

        $parametros_post = array();
        
        $sesion = curl_init("http://localhost/radicacionvirtualcuentas/web/api_dev.php/api/alertas_rvsp/list.json?");
        //Define el tipo de ejecución, en este caso POST
        curl_setopt($sesion, CURLOPT_POST, true);
        //Se ingresan los parametos estabelcidos 
        curl_setopt($sesion, CURLOPT_POSTFIELDS, http_build_query($parametros_post));
        //Parametros de retorno en cURL
        curl_setopt($sesion, CURLOPT_HEADER, false);
        curl_setopt($sesion, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($sesion, CURLOPT_TIMEOUT_MS, 0.1);
        curl_setopt($sesion, CURLOPT_NOSIGNAL, 0.1);
        //Ejecuta la petición
        $respuesta = curl_exec($sesion);
        //Se cierra la conexión
        curl_close($sesion);
    }

}
