how can i transfer the data from my browser console to my php code. I am using a javascript in the browser console

Viewed 32
 This is the code I am using for the browser console
 <!DOCTYPE html>
    <html lang="en">
        <head>
            <title>Firebase</title>
            <script src="https://www.gstatic.com/firebasejs/7.19.1/firebase-app.js"></script>
            <script src="https://www.gstatic.com/firebasejs/7.19.1/firebase-database.js"></script>
    
            <style type="text/css">
                /* Set the size of the div element that contains the map */
                #map {
                  height: 400px;
                  /* The height is 400 pixels */
                  width: 100%;
                  /* The width is the width of the web page */
                }
              </style>
        </head>
        
        <!-- <body>
            <div id="root"></div>
        </body> -->
    

This is to connect the browser console to firebase database

<script>    
const firebaseConfig = {
      apiKey: "AIzaSyD2SevZI0FJV4jew4Z-c9pl7CxntknqEQY",
      authDomain: "thesisesp8266.firebaseapp.com",
      databaseURL: "https://thesisesp8266-default-rtdb.firebaseio.com",
      projectId: "thesisesp8266",
      storageBucket: "thesisesp8266.appspot.com",
      messagingSenderId: "316864477515",
      appId: "1:316864477515:web:56b460e9ce1d3a088550ce",
      measurementId: "G-F3SG81M2L6"  
};

This is to print the data from database to browser console

firebase.initializeApp(firebaseConfig);
database = firebase.database();

var ref = database.ref('GPS');
ref.on('value', gotData, errData);
 
function gotData(data){
    console.log(data.val());
    var GPS = data.val();
    var keys = Object.keys(GPS);
    console.log(keys);
}
function errData(err){
    console.log('Error!');
    console.log(err);
}
</script>
</body>
</html>
0 Answers
Related