I'm having an issue with connecting my eps32 localhost web server.My php and arduino code is mentioned below

The esp32,localhost web server is connected as a lan network using a switch.The network has established successfully.But when i run the code it displays http request code is -1.Can anyone help me with this issue?
arduino code
#include <EthernetENC.h>
#include <Ethernet.h>
#include <SPI.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <ESP32Lib.h>
#include <lwip/tcpip.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // MAC address of ESP32
IPAddress ip(192, 168, 43, 20); // IP address of ESP32
IPAddress serverIP(192, 168, 43, 129);// IP address of the local web server
const int serverPort = 443;
const char* serverPath = "http://192.168.43.10/Hardware%20Project%20Web%20site%20(1)/Hardware%20Project%20Web%20site/input.php";

EthernetClient client;
HTTPClient httpClient;

void setup() {
//Ethernet.init(15);
tcpip_init(NULL, NULL);

Ethernet.begin(mac, ip);
Serial.begin(115200);

delay(3000);

// Wait for Ethernet to connect

Serial.println("Ethernet connected");
Serial.print("IP address: ");
Serial.println(Ethernet.localIP());
}

void loop() {
HTTPClient http;
if (client.connect("192,168,43,10", serverPort)) {
Serial.println("Connected to server");

// Send HTTP GET request
http.begin(serverPath);
//Serial.println(http.begin(serverPath));
Serial.println("test 2");
//Serial.println("httpCode " + String(httpCode));
//int httpCode = http.GET();
int httpCode = http.GET();
Serial.println("httpCode " + httpCode);
if (httpCode == HTTP_CODE_OK) {
  // Read the response as a string
  String response = http.getString();
  Serial.println("httpCode " + String(httpCode));

  // Parse the JSON data
  DynamicJsonDocument jsonDocument(1024);
  deserializeJson(jsonDocument, response);
  
  // Access the message field
  const char* message = jsonDocument["message"];

  // Print the message
  Serial.print("Received message: ");
  Serial.println(message);
} else {
  Serial.print("HTTP request failed with error code: ");
  Serial.println(httpCode);
}

http.end();
client.stop();

} else {
Serial.println("Failed to connect to server");
}

delay(3);
}

PHP CODE

<?php
$host="127.0.0.1:3325";
$root="root@";
$dbPass="";
$dbName="alertproject";
$conn=mysqli_connect($host,$root,$dbPass,$dbName);

//$ip = "192.168.43.15"; // Replace with the IP address of your ESP32
//$port = 80;
$message1="no message to print\n";


if(isset($_POST['submit'])){
    $check=1;
    $message=$_POST['message'];
    $file=$_FILES['image'];
    $fileName=$_FILES['image']['name'];
    $fileTmpName=$_FILES['image']['tmp_name'];
    $fileError=$_FILES['image']['error'];
    $fileType=$_FILES['image']['type'];
    $fileSize=$_FILES['image']['size'];
    $user_id=$_SESSION['user_id'];
    $floorNo=$_POST['floorNo'];
    $fileExt= explode('.',$fileName);
    $fileActExt= strtolower(end($fileExt));
    $allowed = array('jpg','jpeg','png','pdf');
    if($fileName!=""){
        if(in_array($fileActExt,$allowed)){
            if($fileError==0){
                if($fileSize<1000000){
                    $fileNameNew= uniqid('',true).".".$fileActExt;
                    $fileDestination='uploads/'.$fileNameNew;
                    move_uploaded_file($fileTmpName,$fileDestination);      
                }
                else{
                    echo "<script> alert('ur file is too big!') </script>";
                }
            }
            else{
                echo "<script> alert('There was an error uploding ur file!') </script>";
            }
    
        }
        else{
            echo "<script> alert('you cannot upload files of this type!') </script>";
        }
    }
    $stmt1=$conn->prepare("UPDATE update_message SET message=?,image=?");  //updating values in update message table
    $stmt1->bind_param("ss",$message,$fileDestination); 
    $stmt1->execute();
    $stmt=$conn->prepare("insert into message(userId,message,image,floorNo)
    values(?,?,?,?)"); //inserting values in message tables

    // code to pass data to esp32 board using json
    //$myObj=(object)array();
    

    //$myObj=new stdClass();
    // $myObj=(object)array();
    // $sql="SELECT message,image FROM update_message WHERE id=1";
    // foreach($conn->query($sql) as $row){
    //     $myObj->message=$row['message'];
    //     $myObj->image=$row['image'];
    //     $myJSON = json_encode($myObj);
    // } 

    // if(!empty($message)){
    //     $response = [
    //         'message' => "jagath",
    //         //'image' => $image1
    //     ];
        
    //     // Send JSON response
    //     //header('Content-Type: application/json');
    //     echo json_encode($response);
    // }

    $stmt2 = $conn->prepare("SELECT message, image FROM update_message WHERE id = 1");
    $stmt2->execute();
    $stmt2->bind_result($message1, $image1);
    $stmt2->fetch();
    $stmt2->close();
    // $conn->close();
    $stmt->bind_param("isss",$user_id,$message,$fileDestination,$floorNo);
    $stmt->execute();
    //header("location:web_inform.php");//if there are no outputs or line spaces in the programme we can use header other wise following code
    //echo '<script>window.location.href = "web_inform.php";</script>';
    $stmt->close();
    //$conn->close();

//     $response = [
//         'message' => "malinda",
//         //'image' => $image1
//     ];

//     // Send JSON response
//     //header('Content-Type: application/json');
//     echo json_encode($response);
//     //echo '<script>window.location.href = "web_inform.php";</script>';
 }
 $stmt4 = $conn->prepare("SELECT message, image FROM update_message WHERE id = 1");
 $stmt4->execute();
 $stmt4->bind_result($message1, $image1);
 $stmt4->fetch();
 $stmt4->close();
 $conn->close();

 $response = [
    'message' => $message1,
];
        
    //     // Send the response as JSON
    //     //header('Content-Type: application/json');    
echo json_encode($response);
?
**the output**
<?php
$host="127.0.0.1:3325";
$root="root@";
$dbPass="";
$dbName="alertproject";
$conn=mysqli_connect($host,$root,$dbPass,$dbName);

//$ip = "192.168.43.15"; // Replace with the IP address of your ESP32
//$port = 80;
$message1="no message to print\n";


if(isset($_POST['submit'])){
    $check=1;
    $message=$_POST['message'];
    $file=$_FILES['image'];
    $fileName=$_FILES['image']['name'];
    $fileTmpName=$_FILES['image']['tmp_name'];
    $fileError=$_FILES['image']['error'];
    $fileType=$_FILES['image']['type'];
    $fileSize=$_FILES['image']['size'];
    $user_id=$_SESSION['user_id'];
    $floorNo=$_POST['floorNo'];
    $fileExt= explode('.',$fileName);
    $fileActExt= strtolower(end($fileExt));
    $allowed = array('jpg','jpeg','png','pdf');
    if($fileName!=""){
        if(in_array($fileActExt,$allowed)){
            if($fileError==0){
                if($fileSize<1000000){
                    $fileNameNew= uniqid('',true).".".$fileActExt;
                    $fileDestination='uploads/'.$fileNameNew;
                    move_uploaded_file($fileTmpName,$fileDestination);      
                }
                else{
                    echo "<script> alert('ur file is too big!') </script>";
                }
            }
            else{
                echo "<script> alert('There was an error uploding ur file!') </script>";
            }
    
        }
        else{
            echo "<script> alert('you cannot upload files of this type!') </script>";
        }
    }
    $stmt1=$conn->prepare("UPDATE update_message SET message=?,image=?");  //updating values in update message table
    $stmt1->bind_param("ss",$message,$fileDestination); 
    $stmt1->execute();
    $stmt=$conn->prepare("insert into message(userId,message,image,floorNo)
    values(?,?,?,?)"); //inserting values in message tables

    // code to pass data to esp32 board using json
    //$myObj=(object)array();
    

    //$myObj=new stdClass();
    // $myObj=(object)array();
    // $sql="SELECT message,image FROM update_message WHERE id=1";
    // foreach($conn->query($sql) as $row){
    //     $myObj->message=$row['message'];
    //     $myObj->image=$row['image'];
    //     $myJSON = json_encode($myObj);
    // } 

    // if(!empty($message)){
    //     $response = [
    //         'message' => "jagath",
    //         //'image' => $image1
    //     ];
        
    //     // Send JSON response
    //     //header('Content-Type: application/json');
    //     echo json_encode($response);
    // }

    $stmt2 = $conn->prepare("SELECT message, image FROM update_message WHERE id = 1");
    $stmt2->execute();
    $stmt2->bind_result($message1, $image1);
    $stmt2->fetch();
    $stmt2->close();
    // $conn->close();
    $stmt->bind_param("isss",$user_id,$message,$fileDestination,$floorNo);
    $stmt->execute();
    //header("location:web_inform.php");//if there are no outputs or line spaces in the programme we can use header other wise following code
    //echo '<script>window.location.href = "web_inform.php";</script>';
    $stmt->close();
    //$conn->close();

//     $response = [
//         'message' => "malinda",
//         //'image' => $image1
//     ];

//     // Send JSON response
//     //header('Content-Type: application/json');
//     echo json_encode($response);
//     //echo '<script>window.location.href = "web_inform.php";</script>';
 }
 $stmt4 = $conn->prepare("SELECT message, image FROM update_message WHERE id = 1");
 $stmt4->execute();
 $stmt4->bind_result($message1, $image1);
 $stmt4->fetch();
 $stmt4->close();
 $conn->close();

 $response = [
    'message' => $message1,
];
        
    //     // Send the response as JSON
    //     //header('Content-Type: application/json');    
echo json_encode($response);

The Output
HTTP request failed with error code: -1

Connected to server

test 2

Please try to clean this up a little. Your code isn't formatted correctly and the PHP is hard to read.

i'm very sorry
i will clearly provide my php response part

 $stmt4->execute();
 $stmt4->bind_result($message1, $image1);
 $stmt4->fetch();
 $stmt4->close();
 $conn->close();

 $response = [
    'message' => $message1,
];
        
    //     // Send the response as JSON
    //     //header('Content-Type: application/json');  
echo json_encode($response);

can u give me a solution for this

IDK, honestly I probably won't try until it's formatted in a better way. I don't mean to be rude, it's just too hard to work through.

Also, you realize that the Server IP you provide and the URL you are trying to reach are different, right? Your server ip is 129 but the URL is for an address ending in 10.

that is correct.192.168.43.10 is my computer's ethernet module ip address while 192.168.43.129 is my computer's ip address.When i used 192.168.43.10 the 02 components didn't ping well.but when i used 192.168.43.10 the pinging was succesfull.

I'm formatted it in a right way.Can u give it a try?

.
Is your host running on 443 or 3325? Because in your sketch your port is set to 443.

i'm using xampp server on 3325 it is running Mysql.on 443 and 80 it is running apache server which the local web is hosted.

But should you be trying to connect directly to MYSQL? In other words, is 443 the correct port you should be using from the ESP32 to connect to the server?

Also, the URL you use for your query has no port used at all. So, that is going to go to appache, but that is not where the client connected. The client connected to 443.

can u explain me a little bit more?

Well, look at your code. First you connect to the server:
if (client.connect("192,168,43,10", serverPort)) {
in this case, the server port is 443. Then the URI you use for the request is this:

http://192.168.43.10/Hardware%20Project%20Web%20site%20(1)/Hardware%20Project%20Web%20site/input.php

But that has no port assigned at all, so it will use port 80 by default. Which is not where you connected. Shouldn't the serverport be set to 3325 and the url be as follows:

http://192.168.43.10:3325/Hardware%20Project%20Web%20site%20(1)/Hardware%20Project%20Web%20site/input.php

Also, you're not allowed to use Parens in a web address unless it's in a parameter (after the ?). So, I would remove it from yours. That might be why you're unable to get a request too.
Also, if Apache is running on port 80, then it is possible you just need to change your server port to port 80 and leave the url without a port assigned to connect to apache.

can u explain me little bit about this

seo - Is it bad to use parentheses in a URL - Webmasters Stack Exchange.

I guess you can have them in the path but it doesn't mean that it's definitely going to work. Also, are you 100% sure that you can access that URL from a web browser? It's a simple get. So you should be able to enter that address into your browser and get the same response. If it doesn't work, then it's not the esp32. However, if it does work, your server port should be 80.

(http://192.168.43.10/Hardware%20Project%20Web%20site%20(1)/Hardware%20Project%20Web%20site/input.php) when i copy this link and paste it in the browser it shows me the json output
{"message":"no lectures today"}.But in the tab it says the webpage is not secure.Does this not secure may be the reason which affect for this?

Nope. Try changing this line:
const int serverPort = 443;
to this:
const int serverPort = 80;

and give it a try.

Your browser is connecting on port 80 so that is what the ESP32 should connect on as well.

i changed it but it gives me the same output httpcode as -1.

Do you also get a serial message saying that it is connected to the server? What is the full serial output? You may want to make the delay at the end longer than 3ms. That is going to try and bombard your server with 333 requests a second. I would make it something much longer. That could also be why it's not working.

the output is in the serial monitor is

HTTP request failed with error code: -1

Connected to server

test 2
it says it has successfully connected to the server

But that is not the correct order those functions should be taking place in. Try making the request only once from the esp 32. You can do this by moving everything above the delay into the setup vs having it in the loop. Then it will only make one request to your server. Not one every 3milliseconds.