Data getting and uplading it

Hi, I'm needing help. I'm doing a code to get data from a DHT11 sensor and upload it as a Json format from a ESP8266. The problem here is that I can't manage to do the connection, plus, the code is not swiping the data from the sensors. If anyone knows what my problem might be, i would rlly appriciate it. I'll leave some of the codes I tryed this with.
Hola, necesito ayuda. Estoy haciendo un código para obtener datos de un sensor DHT11 y cargarlos en formato Json desde un ESP8266. El problema aquí es que no puedo realizar la conexión y además el código no pasa los datos de los sensores. Si alguien sabe cuál podría ser mi problema, se lo agradecería mucho. Dejaré algunos de los códigos con los que probé esto.
`

#include <ESP8266WiFi.h>
#include <DHT.h>
#include <WiFiClient.h>


const char* ssid = "IoTB";
const char* password = "inventaronelVAR";


const char* serverAddress = "https://subite-back.vercel.app/hard";
const int serverPort = 80;


#define DHTPIN 0  
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);


WiFiClient client;

void setup() {
  Serial.begin(115200);
  delay(10);

 
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connection");
  Serial.println("IP: ");
  Serial.println(WiFi.localIP());

  dht.begin();
}

void loop() {

  float temperatura = dht.readTemperature();
  float humedad = dht.readHumidity();


  if (isnan(temperatura) || isnan(humedad)) {
    Serial.println("Error al leer el sensor DHT11");
    return;
  }

 
  String jsonPayload = "{\"temp\":" + String(temperatura) + ",\"hum\":" + String(humedad) + "}";


  String postData = "POST /ruta-api HTTP/1.1\r\n";
  postData += "Host: " + String(serverAddress) + "\r\n";
  postData += "Content-Type: application/json\r\n";
  postData += "Content-Length: " + String(jsonPayload.length()) + "\r\n\r\n";
  postData += jsonPayload;


  if (client.connect(serverAddress, serverPort)) {
    Serial.println("Conectado al servidor");
    client.print(postData);


    while (client.connected()) {
      if (client.available()) {
        String response = client.readStringUntil('\r');
        Serial.println("Respuesta del servidor: ");
        Serial.println(response);
      }
    }
    client.stop();
  } else {
    Serial.println("Error al conectarse al servidor");
  }


  delay(60000);  
}

don't double post!

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum. It will help you get the best out of the forum in the future.

Thank you.