-->
Page 1 of 2

I cannot send data to my webpage

PostPosted: Sun Aug 30, 2020 10:31 am
by dimbil
I am trying to send data from arduino-esp8266 to my webpage but I cannot make it
This is the 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.setDebugOutput(true);

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 ");
}
void loop()
{
// wait for WiFi connection
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();

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);
}

Is there someone to help me please?

Re: I cannot send data to my webpage

PostPosted: Sun Aug 30, 2020 6:19 pm
by QuickFix
Is this a different question? Didn't you ask this exact same question five days ago? :roll:

Re: I cannot send data to my webpage

PostPosted: Mon Aug 31, 2020 3:08 am
by dimbil
It is the same question but I haven't got any solution tomy problem yet
Can you please help me?

Re: I cannot send data to my webpage

PostPosted: Mon Aug 31, 2020 5:44 am
by AcmeUK
It is the same question but I haven't got any solution tomy problem yet

Yes you have!
You said you get this error message:-
It displays the following:
0f000, len 1384, room 16
tail 8
csum 0xef
csum err
ets-main.c

@Bonzo said:-
So that error is something in your code and not a problem connecting to the webserver

What have you done to isolate the problem in your code?