Receive variables post and write them in Html


I am receiving data by post from an android system, when responding with echo , this data reaches android. Now I want to use this data to use it in an html page, how can I do it? By the way, I use the Slim framework.

       require 'Slim/Slim.php';

       $sistema = new \Slim\Slim();
       $sistema->get('/', function() {
           echo("Hola mundo!");
       $sistema->post('/gps', function() {
          $longitud = $_POST['long'];
          $latitud = $_POST['lat'];
          echo("Posición: " . $longitud . " " . $latitud);
asked by manduinca 11.03.2016 в 19:38

3 answers


In the end I did not find a better solution than to pass my data to a database. With the database ready, it is easy to be able to use the data in any route of my html page.

I guess this is what good practices dictate.

answered by 11.03.2016 / 22:20

You should check the Architecture Rest, in general terms you will have to create an api, through which you will expose your resources with which you can interact with the verbs http

  • get (ask for data)
  • post (send data)
  • put (update data)
  • delete (delete data)

So from any device such as a cell phone, an arduino card, or another device that can communicate through http, you can send data through a post request, and through a request get the data of any resource, and so render it in a browser (to do this, you can use ajax, or some frammework as an angle).

As you can see with REST you get many benefits, such as interaction between different devices, plus you will get scalability, and many more benefits,

I think you should document a bit more about REST to have a better idea, by the way, using slim is a success because it is a microframework oriented to APi's

answered by 11.03.2016 в 19:54

You should use a Slim template engine Offer Twig on its official website

answered by 11.03.2016 в 19:50