This is my code
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
ESP8266WiFiMulti WiFiMulti;
String myURL ="http://alfa8400.000webhostapp.com/index.php?";
//
String first = "alfa";
String second = "vita";
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println();
Serial.println();
for (uint8_t t = 4; t > 0; t--) {
Serial.printf("[SETUP] WAIT %d...", t);
Serial.flush();
delay(1000);
}
WiFi.mode(WIFI_STA);
WiFiMulti.addAP("user-name", "pwd ");
}
if ((WiFiMulti.run() == WL_CONNECTED)) {
WiFiClient client;
HTTPClient http;
Serial.print("[HTTP] begin...\n");
if (http.begin(client, myURL+"first="+first+"&second="+second))
Serial.print("[HTTP] GET...\n");
//
http.begin(myURL); //
int httpCode = http.GET();
// httpCode will be negative on error
if (httpCode > 0) {
//
Serial.printf("[HTTP] GET... code: %d", httpCode);
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
String payload = http.getString();
Serial.println(payload);
}
} else {
Serial.printf("[HTTP] GET... failed, error: %s", http.errorToString(httpCode).c_str());
}
http.end();
} else {
Serial.printf("[HTTP} Unable to connect");
}
}
delay(10000);
}
Can you please help me?