Any way to see php POST data from external sources?

OK ... so here's the deal. I experimented with RFID technology. In short, an RFID reader can send data read from tags to an HTML page as a data stream. Therefore, data is sent as POST data. Let's say I have a page called datastream.php that takes post data and writes data to a MySQL database and what it is.

Is there a way to create a separate page (data-monitor.php) that will display the POST data that is sent from the RFID reader to the datastream.php page in real time (or near it)? Maybe AJAX? Sorry, no code examples. This is a high level question to see if it will even work. I had the feeling that I would probably just update data-monitor.php with a div page or something with data from MySQL tables, as it would be written using AJAX.

+4
source share
2 answers

2 ways, I think, the first is to create a php page and use $_POST['input name'], and then the echovalues, or maybe save them in a database !.

, POST, , AJAX, , . , ?

AJAX, php-:

<script>
    function usersignup()
    {
      var username = document.getElementById("username").value;
      var email = document.getElementById("email").value;
      var password = document.getElementById("password").value;
      var r_password = document.getElementById("r_password").value;
      var gender = document.getElementById("gender").value;



      if(r_password != password)
        {
            document.getElementById('notmatchpass').style.display ='block';
        }

        else
        {

      if(username && email && password && gender)
      {
        $.ajax
        ({
          type: 'post',
          url: 'lib/signup.php',
          data: 
          {
             newuser:username,
             user_email:email,
             user_password:password,
             user_gender:gender
          },
          success: function (response) 
          {
            document.getElementById("respond").innerHTML=response+document.getElementById("respond").innerHTML;
            document.getElementById("signupform").innerHTML="";

          }, 
                error: function(response) {
                console.log(response);
            }
        });
      }
      }
      return false;
    }
</script>

, ( )

error: function(response) {
console.log(response);}

, , , :

  • F12
  • ()

enter image description here

  • Parmas

enter image description here

  • ,

enter image description here

, , , , . .

+1

, .. tables.php, MySQL

data-monitor.php , tables.php tables.php

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
var timeout = setInterval(reloaddata, 1000);    
function reloaddata () {
     $('#incomingdata').load('tables.php');
}
</script>

<div id="incomingdata">
<!--This div will display data from tables.php and it will refresh every second-->
</div>
0

Source: https://habr.com/ru/post/1653366/


All Articles