Did you run the curl command in the same network environment?
do you see any text returned from the curl command?
can you try with
if (WiFi.status() == WL_CONNECTED) {
WiFiClientSecure client;
client.setInsecure();
HTTPClient http;
String url = "https://iotgassensory.com/post-data.php";
String payload = "api_key=" + apiKey + "&value1=27.88&value2=9.45&value3=1004.7";
http.begin(client, url);
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
int httpResponseCode = http.POST(payload);
if (httpResponseCode > 0) {
Serial.print("HTTP Response code: ");
Serial.println(httpResponseCode);
String response = http.getString();
Serial.println(response);
} else {
Serial.print("Error code: ");
Serial.println(httpResponseCode);
}
http.end();
}