Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By 8n1
#37893 Glad I could help a bit.
But you indeed misunderstood how this works. This is no apache quirks, wrong config or anything like this.
What your php code does right now is nothing more then displaying/returning the data the same client just sent. There is really no way that the value you see changes anyhow.

Your php code needs to do 2 different things to do what you want.
The first is to save/write the data a client sents somewhere, usually a database like sqlite or mysql will be used for this. (Or just use a simple file like the user "LauBaz" did who shared his solution on page 1 of this thread.)
The second is to read the data from there.

You could decide what to do based on the fact that a client sends some data. (Or just use 2 different php scripts and call them accordingly: e.g. write.php, read.php)
So if a client connects and sends some data your code should save it somewhere.
And if a client connects and doesn't sends any data your code should try to read the data from where you saved it.

Here are two sites that might help you: (Even though they not explain in detail how all this works)
https://primalcortex.wordpress.com/2015 ... -database/
http://afterhoursengineering.net/blog/b ... -database/
User avatar
By Stampede
#37896 Ah Hah, I see. That makes a whole lot of sense.
I had cut LuaBaz's write script out of my PHP file because I kept getting permissions errors.
I will work on a simple backend storage script, and I will post my solution when I get it running.

Thanks for the links, and the advice. I've been knocking on so many doors looking for that crumb of knowledge!

All the best,
Peter
User avatar
By Mihi
#39184 Read agian 8n1 reply.
Your PHP code is not storing any data to some file or DB. Your PHP code is just replying what was sent to it in that session.

Check e.g. this to store it to a file: http://php.net/manual/en/function.file-put-contents.php

e.g. change you PHP code to this :
Code: Select all$file = 'data.log';
if(isset($_GET["temp1"])){
  $val = $_GET["temp1"];
  $tempesp = "Temperature=";
  $tempesp .= ($val);   
  echo $tempesp; 
  file_put_contents($file, $tempesp);
} else {
  echo "No data received";
}
  $all_data = file_get_contents($file);
  echo $all_data;