Help me to escape from this "call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)" error

void loop() {
// put your main code here, to run repeatedly
readsuccess = getid();

if(readsuccess) {
digitalWrite(ON_Board_LED, LOW);
HTTPClient http; //Declare object of class HTTPClient

String UIDresultSend, postData;
UIDresultSend = StrUID;

//Post Data
postData = "UIDresult=" + UIDresultSend;

http::begin(WiFiClient,192.168.0.00,COM8,NodeMCU_RC522_Mysql/getUID.php)//.begin("http://192.168.1.23/NodeMCU_RC522_Mysql/getUID.php");  //Specify request destination
http.addHeader("Content-Type", "application/x-www-form-urlencoded"); //Specify content-type header

int httpCode = http.POST(postData);   //Send the request
String payload = http.getString();    //Get the response payload

Serial.println(UIDresultSend);
Serial.println(httpCode);   //Print HTTP return code
Serial.println(payload);    //Print request response payload

http.end();  //Close connection
delay(1000);

digitalWrite(ON_Board_LED, HIGH);
}
}

the error message tells it all. see the examples

You are using 'http' the namespace, not 'http' the HTTPClient object. And you left off the ';' at the end of the statement.

I think you meant:

http.begin(WiFiClient,"http://192.168.1.23/NodeMCU_RC522_Mysql/getUID.php");

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.