Http error code

Hi,

The function below sends a string to a database through a php code.

However, when run it, I get an error code but I'm not sure what I'm doing wrong.

httpRequestData: api_key=tPmAT5Ab3j7F9&value1=182.3.217.63
Error code: -1

If in place of the extIP I use a string like "123", it works fine.

Surely is the ip address which is the cause of the problem.

Any help is appreciated.
TIA

void db_send() {
  //Check WiFi connection status

  if (WiFi.status() == WL_CONNECTED) {
    HTTPClient http;

    // Your Domain name with URL path or IP address with path
    http.begin(serverName);

    // Specify content-type header
    http.addHeader("Content-Type", "application/x-www-form-urlencoded");

    // Prepare your HTTP POST request data
    String httpRequestData = "api_key=" + apiKeyValue + "&value1=" + extIP + "&value2=" + 0 + "&value3=" + 0 + "";
    Serial.print("httpRequestData: ");
    Serial.println(httpRequestData);

    // Send HTTP POST request
    int httpResponseCode = http.POST(httpRequestData);

    if (httpResponseCode > 0) {
      Serial.print("HTTP Response code: ");
      Serial.println(httpResponseCode);
    }
    else {
      Serial.print("Error code: ");
      Serial.println(httpResponseCode);
    }

    // Free resources
    http.end();
  }
  else {
    Serial.println("WiFi Disconnected");
  }
}

You may need to encode your URL by replacing special characters (i.e. periods) with certain codes. In your case you would replace the periods with %2E.

URL Encoding Reference