Também estava tentando, consegui dessa forma.
#include <WiFi.h>
#include <HTTPClient.h>
const char *ssid = "Sua Rede Wi-Fi";
const char *password = "Senha do Wi-Fi";
HTTPClient http;
int temp = 0; // utilização dessa variavel somente para exemplo
int humid = 0; // utilização dessa variavel somente para exemplo
void setup() {
delay(3000); //Aguarda 3 segundos
Serial.begin(9600);
Serial.println("Aguardando conexão");
// Tenta conexão com Wi-fi
WiFi.begin(ssid, psw);
while ( WiFi.status() != WL_CONNECTED ) {
delay(100);
Serial.print(".");
}
Serial.print("\nWI-FI conectado com sucesso: ");
}
void loop(){
temp += 3; // irá acrescentar 3 na variavel a cada ciclo
humid += 5; // irá acrescentar 5 na variavel a cada ciclo
Serial.println("Gravando dados no BD: ");
String endWeb = "http://unitempo.000webhostapp.com/arduino/salvardados.php?temp=";
endWeb += temp;
endWeb += "&humid=";
endWeb += humid;
Serial.println(endWeb); // só para ver o link no monitor serial
http.begin(endWeb);
int httpCode = http.GET(); //Make the request
if (httpCode > 0) { //Check for the returning code
String payload = http.getString();
//Serial.println(httpCode); // funciona sem essa linha
Serial.println(payload);
}
else {
Serial.println("Error on HTTP request");
}
http.end(); //Free the resources
delay(5000); // vai enviar o link a cada 5 segudos
}