<?php 
$datos=false;
$fexini="";
$fexfin="";
$token="";
if (isset($_GET["token"]))
	{
	$fexini=$_GET["fechain"];
	$fexfin=$_GET["fechaout"];
	$token=$_GET["token"];
	$datos=true;
	}

if (isset($_POST["token"]))
	{
	$fexini=$_POST["fechain"];
	$fexfin=$_POST["fechaout"];
	$token=$_POST["token"];
	$datos=true;
	}
if (!$datos || $fexini=="" || $fexfin=="") { echo("ERROR: Faltan datos"); exit(); }
if ($token != "3cLS3LG8aqL2AHmzMuigZjvnWdPyxrob") { echo("ERROR: TOKEN INCORRECTO"); exit; }
$clave="clave$$";
//echo($fexini." - ".$fexfin." - ".$clave);
$fields = array(
'fexini' =>  urldecode($fexini),
'fexfin' => urldecode($fexfin),
'clave' => "clave$$" );
//open connection
$ch = curl_init("http://192.168.32.253/ws/");
//set the url, number of POST vars, POST data
//curl_setopt($ch,CURLOPT_URL, "http://192.168.32.253/ws/");
//curl_setopt($ch, CURLOPT_HTTPHEADER , array('Content-type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
//execute post
$result = curl_exec($ch);

echo($result);

?>