include 'log.php';
require "class/cnx.php";
require "class/controlador.php";
$coneccion = coneccion();
$o = new Controlador();
$log = new Logging();
$arrayMeses = array("", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
$debug = true;
$write = false;
$sil_url = 'http://sil.senado.cl/cgi-bin/';
$fechas_url = $sil_url . 'sil_ultproy.pl';
$proyectos_url = $sil_url . 'sil_proyectos.pl?';
$autores_url = $sil_url . 'sil_autores.pl?';
$desde = "30/04/2010";
$hasta = "09/05/2010";
$log->lwrite_ln();
$log->lwrite("Periodo: " . $desde . "-" . $hasta);
$log->lwrite_ln();
if ($debug) {
    echo "<br>----------------Periodo: " . $desde . "-" . $hasta . "-------------------<br>";
}
$fechas_post = file_get_contents_curl($fechas_url, $desde, $hasta);
$fechas_html = str_get_html($fechas_post);
$num = 0;
foreach ($fechas_html->find('td[class="TEXTpais"]') as $nro) {
    $nro_boletin = trim(str_replace("&nbsp;", "", $nro->plaintext));
    if ($debug) {
        echo "<h1>" . $nro_boletin . "</h1>";
    }
    //FALTA: controlar si ya existe proyectoLey -> 2010-05-09 se incorporó validación Carlos Martínez
    //get proyectoLey