Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Can I get a transaction between nodemcu esp8266 and asp.net mvc web api localhost

const char* ssid = "ssid";
const char* password = "pass";

void setup() 
{
  Serial.begin(115200);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(1000);
    Serial.println("Connecting...");
  }
}

void loop() 
{
  if (WiFi.status() == WL_CONNECTED) 
  {
    HTTPClient http; //Object of class HTTPClient
    http.begin("http://localhost:56542/api/values/1");
    int httpCode = http.GET();
Serial.print(httpCode);
    if (httpCode > 0) 
    {

      Serial.print("work:");

    }else{
       Serial.print("nor work:");
      }
    http.end(); //Close connection
  }
  delay(100);
}

I want to draw data from localhost from nodemcu, how can I do it while working in localhost visual studio?

http.begin (the "http: // localhost: 56542 / API / values ​​/ 1"); what does it mean -1, but I normally have data -1

Comments