#include <WiFiNINA.h> #define sensorPin A5 char ssid[] = "test"; char pass[] = ""; int status = WL_IDLE_STATUS; char server[] = "www.elithecomputerguy.com"; String postData; String postVariable = "temp="; WiFiClient client; void setup() { Serial.begin(9600); while (status != WL_CONNECTED) { Serial.print("Attempting to connect to Network named: "); Serial.println(ssid); status = WiFi.begin(ssid, pass); delay(10000); }
http://yourphpserver/add_data.php?variable1=value1&variable2=value2&variable3=value3...


void loop() {
  int reading = analogRead(sensorPin);
  float voltage = reading * 5.0;
  voltage /= 1024.0;
  float temperatureC = (voltage - 0.5) * 100 ;
  float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;

  postData = postVariable + temperatureF;

  if (client.connect(server, 80)) {
    client.println("POST /test/post.php HTTP/1.1");
    client.println("Host: www.elithecomputerguy.com");
    client.println("Content-Type: application/x-www-form-urlencoded");
    client.print("Content-Length: ");
    client.println(postData.length());
    client.println();
    client.print(postData);
  }

  if (client.connected()) {
    client.stop();
  }
  Serial.println(postData);

  delay(3000);
}

PHP Script – post.php

<?php
$time = time();
$tempF = $_POST["temp"];
$file = 'temp.html';
$data = $time."  -  ".$tempF;
file_put_contents($file, $data);
?>