#include <WiFi.h>
#include <HTTPClient.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
Serial.print("Connecting to WiFi");
WiFi.begin("Wokwi-GUEST", "", 6);
while (WiFi.status() != WL_CONNECTED) {
delay(100);
Serial.print(".");
}
Serial.println(" Connected!");
HTTPClient http;
http.begin("https://lastone.cognitiveservices.azure.com/face/v1.0/verify");
http.addHeader("Content-Type", "application/json");
http.addHeader("Content-Length", "0");
http.addHeader("Ocp-Apim-Subscription-Key", "38280cf77076488e989e45a7ebf837eb");
String requestBody = "{\"faceId1\": \"d6c709e9-d96f-4eb5-a2ca-5c49e471d83a\", \"faceId2\": \"c3e81c4b-aaf6-458e-adcf-5a85e621a315\"}";
int httpResponseCode = http.POST(requestBody);
String response = http.getString();
Serial.println(response);
if (httpResponseCode > 0) {
Serial.println(httpResponseCode);
Serial.println(response);
} else {
Serial.print("Error on sending POST: ");
Serial.println(httpResponseCode);
}
http.end();
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}