Search code examples
httparduinoesp8266arduino-c++

I cant seem to get HTTP request working on NodeMCU


My main problem is making the transition from this command which is obsolete:

http.begin("http://192.168.1.43/getUID.php")

to this

WiFiClient client;
HTTPClient http;

String serverPath = serverName + "?rfid=" + content;
  
// Your Domain name with URL path or IP address with path
http.begin(client, serverPath.c_str());

What do I put in the client and server path?


Solution

  • You start a session with http.begin(client, serverPath) and then send a request with http.GET() or http.POST()

    So your code should work like this:

    WiFiClient client;
    HTTPClient http;
    
    http.begin(client, "http://192.168.1.43/getUID.php");
    http.GET();