<?php
    header("Access-Control-Allow-Origin: *");
    header('Access-Control-Allow-Credentials: true');
    header('Access-Control-Max-Age: 8640000');

    mysql_connect("localhost","almanoti_cotiz","Lse5I9meGY7f");
    mysql_select_db ("almanoti_base");

                                    $sql = "SELECT * FROM `cotizaciones_new` ORDER BY `cotizaciones_new`.`ID` DESC LIMIT 1";
                                    $consulta = mysql_query ($sql);
                                    while ($row = mysql_fetch_array($consulta))
                                    {
                                    $compra = $row["compra"];
                                    $venta = $row["venta"];
                                    $comprab = $row["comprab"];
                                    $ventab = $row["ventab"];
                                    $fecha = $row["fecha"];
                                    $up1 = $row["up1"];
                                    $up2 = $row["up2"];
                                    $up3 = $row["up3"];
                                    $up4 = $row["up4"];


                                    $up1 = str_replace('"', "'", $up1);
                                    $up2 = str_replace('"', "'", $up2);
                                    $up3 = str_replace('"', "'", $up3);
                                    $up4 = str_replace('"', "'", $up4);

                                    $up1 = str_replace('< >','',$up1);
                                    $up2  = str_replace('< >','',$up2);
                                    $up3 = str_replace('< >','',$up3);
                                    $up4  = str_replace('< >','',$up4);

                                    }
                                    mysql_free_result($consulta2);
?>[{
"compra": "<?php echo $compra?>",
"venta": "<?php echo $venta ?>",
"comprab": "<?php echo $comprab ?>",
"ventab": "<?php echo $ventab ?>",
"fecha": "<?php echo $fecha ?>",
"up1": "<?php echo $up1 ?>",
"up2": "<?php echo $up2 ?>",
"up3": "<?php echo $up3 ?>",
"up4": "<?php echo $up4 ?>"
}]
