Completed design of Website for project. Driving element of web sit is the following code:
<?php
/*
ESP8266: send data to your Domain
Uses POST command to send BME280 data to a designated website
The circuit:
* BME280
* Post to Domain
Original version of this code by Stephan Borsay
Modified with HTML and CSS by techno500 for use with BME280 along with Arduino/ESP8266 sketch:
"NTP_Web_Interface.ino."
*/
date_default_timezone_set("America/Indianapolis");
$TimeStamp = date("Y-m-d h:i:sa");
if( $_REQUEST["fahren"] || $_REQUEST["heat"] || $_REQUEST["hum"] || $_REQUEST["dewpt"]
|| $_REQUEST["cpressure"] || $_REQUEST["bars"] )
{
echo " The Temperature is: ". $_REQUEST['fahren']. "F.
";
echo " The Heat Index is: ". $_REQUEST['heat']. " Heat Index
";
echo " The Temperature is: ". $_REQUEST['hum']. " hum
";
echo " The Dew Point is: ". $_REQUEST['dewpt']. " Dew Point
";
echo " The Barometric Pressure is: ". $_REQUEST['cpressure']. " in. HG.
";
echo " The Barometric Pressure is: ". $_REQUEST['bars']. " millibars
";
echo " The Altitude is: 824 Feet
";
}
$var1 = $_REQUEST['fahren'];
$var2 = $_REQUEST['heat'];
$var3 = $_REQUEST['hum'];
$var4 = $_REQUEST['dewpt'];
$var5 = $_REQUEST['cpressure'];
$var6 = $_REQUEST['bars'];
//$var7 = $_REQUEST['altit'];
$WriteMyRequest=
"<html>".
"<head>".
"<body>".
"<style>".
"body { background: #561C0E no-repeat fixed center;}".
"a,h2,h3 {color: #ffffff;}".
"font-weight: bold;}".
"</style>".
"<title>Observations</title>".
"<h2>".
"Observations".
"<p>Treyburn Lakes
".
"Indianapolis, IN
".
"46239</p></h2>
".
"<p><h3>Last update: " . $TimeStamp . "</p>".
"<p> The Temperature is : " . $var1 . " F. </p>".
"<p>And the Heat Index is : " . $var2 . " F. </p>".
"<p>And the Humidity : " . $var3 . " % </p>".
"<p>And The Dew Point is : " . $var4 . " F. </p>".
"<p>And The Barometric Pressure is : " . $var5 . " in. HG. </p>".
"<p>And The Barometric Pressure is : " . $var6 . " mb</p>".
"<p>And The Altitude is : 824 Feet </p>
". // Altitude as read by GPS for project location
"<a href='https://pathToAbout.php'>About</h3></a>".
"</head>".
"</body>".
"</html>";
file_put_contents('display.html', $WriteMyRequest);
?>
This is the PHP code that creates the "Observations" menu option of the website.
Domain Hosted, WiFi Client.Server Based --ESP8266
PHP code above receives the POST from the "NTP_Web_Interface.ino" sketch. POST is developed with use of the "ESP8266HTTPClient" library. Project is unique in the fact that it does not use a Real Time Clock. Every 15 minutes; PHP code rewrites the "Observations" HTML page. Only the "ESP8266" development board and the BME280 are required making for a real low cost project! All timing requirements are provided by using Network Time Protocol and a time server to derive the time and date used in the sketch.
Over the time I have been developing this project; have had allot of help from members of the various forums. Without their help this project would have been impossible. To those that helped and the owners of the various forums; thank you, your help most appreciated!
Attached is the sketch and the php code.
William
Add screen capture
NTP_Web_Interface.zip (14 KB)