<?php require_once "../bin/LineasInvestigacion.php"; try { $accion = $_GET["accion"]; switch ($accion) { case "getHistorial": getHistorial(); break; case "createLine": if ($_POST) { $json = createLines(); //'{"foo-bar": 12345}'; $lineas = new Linea(); $obj = json_decode($json); $lineas->setInstitucion($obj->{'foo-bar'}); print $lineas->getInstitucion(); // 12345 } break; } } catch (Exception $ex) { } function createLines($VaribleName) { return json_decode($_POST[$VaribleName]); } function getHistorial() { //conecto con la base de datos $conn = @mysql_connect("localhost", "root", "");