Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By drekthral
#46547 Hello,
I would like to send data from temperature sensor to my network webserver.
In my arduino IDE I need to make somthing like this :
Code: Select allhttp.begin("http://192.168.10.1/test/esp8266.php/?temp=" + temp);


On my webserver I have php script that takes variable temp and save it.

So I just need to make ESP8266 open "192.168.10.1/test/esp8266.php/?temp=" + variable temp

Any ides how to do that ?

Thanks for every reply :)
User avatar
By Ayush Sharma
#46601 Hello Sir,
I was Doing the Same but It's Really Hard to Understand the Example without some explanation . Sir, Could you please Tell me how this Example will work? I could understand this will send a url request to my website where my php script will understand it.
But this Part: ( Code from Basic HTTP Client Example) :geek:
Code: Select allif(httpCode > 0) {
            // HTTP header has been send and Server response header has been handled
            USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);

            // file found at server
            if(httpCode == HTTP_CODE_OK) {
                String payload = http.getString();
                USE_SERIAL.println(payload);
            }
        } else {
            USE_SERIAL.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
        }


I don't understand.. Help would be really Appreciated! :)
User avatar
By martinayotte
#46614 The actual request is sent when http.GET() is call, then returning the response status code.
If the returned httpCode is 0, it never received any response, probably due to timeout or non-responding server.
If httpCode is higher than 0, server actually provided an response, it could be any, such the famous "404 Page not Found", or a "200 OK", which is HTTP_CODE_OK, in this case the code above simply display the response body received from the server, in your case, whatever your PHP will answer after executing your command.