' . $timestamp . '

'; /* no insert in MySQL database when ?param=NoMySQL */ $MySQL = !($_GET['param']==='NoMySQL'); $servername = 'localhost'; $username = 'username'; $password = 'password'; $dbname = 'MyHome'; $mysqli = new mysqli($servername, $username, $password, $dbname); if ($mysqli->connect_errno) { echo '

Failed to connect to MySQL: (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error . '

'; } else { echo '

Successful connected to MySQL!

'; } $sql = sprintf("INSERT INTO Bell (timestamp) VALUES ('%s')", $mysqli->real_escape_string($timestamp)); if ($MySQL) { if (!$mysqli->query($sql)) { echo '

Error: ' . $mysqli->error . '

'; } } else { echo '

No INSERT (of timestamp) in MySQL table!

'; } $mysqli->close(); /* call ESP8266 ESP-01 with IP 192.168.X.Y to indicate bell at door */ $url = 'http://192.168.X.Y'; if (!($response = file_get_contents($url))) { echo "

Error fetching " . $url . "

"; } else { $xml = new SimpleXMLElement($response); print_r($xml); } ?>