RFID RC522 + NODEMCU ESP8266 + LOCALHOST

hello guys, I’m working on a school project on iot, which is based on RFID RC522 and nodemcu (esp8266) and using a wamp server to connect to localhost, but I have a problem the data is not sent to localhost (trying to read cards validating date on localhost) and I do not know how to solve this, if you can help me I would be very grateful.

*my system:

  1. RFID RC522 + NODEMCU RESP8266 (WIFI)

  2. On my laptop I’m running the following configuration of XAMPP

Apache 2.4.35

MySQL 5.7.23

PHP 7.2.10

  1. Arduino IDE

*source code on arduino is the following :

 #include<SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <SPI.h>
#include <MFRC522.h>

const char* ssid = "Tenda";
const char* password = "*******";

//WiFiClient client;
char  server[] = "192.168.5.8"; //YOUR SERVER

//const char* server="www.google.com";
#define SS_PIN D4 //FOR RFID SS PIN BECASUSE WE ARE USING BOTH ETHERNET SHIELD AND RS-522
#define RST_PIN D8
#define No_Of_Card 3
#define LED_PIN D2
#define LED_CIN D1
WiFiClient client;

//WiFiServer server(80);
SoftwareSerial mySerial(8,9);
MFRC522 rfid(SS_PIN,RST_PIN);
MFRC522::MIFARE_Key key;
byte id[No_Of_Card][4]={
//{16,102,192,73}, //RFID NO-1 1
{188,32,7,133}, //RFID NO-2
{224,43,39,27}//RFID NO-3
};
byte id_temp[3][3];
byte i;
int j=0;
void setup(){
 Serial.begin(115200);
  SPI.begin();
   rfid.PCD_Init();
   pinMode(LED_PIN,OUTPUT);
  pinMode(LED_CIN,OUTPUT);
for( byte i=0;i<6;i++){
key.keyByte[i]=0xFF;
}
// Connect to WiFi network
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 connected");
// Start the server
//Server.begin();
Serial.println("Server started");
Serial.print(WiFi.localIP());
delay(1000);
Serial.println("connecting...");
}
void loop()

{ // Check if a client has connected
int m=0;
if(!rfid.PICC_IsNewCardPresent())
return;
if(!rfid.PICC_ReadCardSerial())
return;
for(i=0;i<4;i++)
{
id_temp[0][i]=rfid.uid.uidByte[i];
delay(50);
}
for(i=0;i<No_Of_Card;i++)
{
if(id[i][0]==id_temp[0][0])
{
if(id[i][1]==id_temp[0][1])
{
if(id[i][2]==id_temp[0][2])
{
if(id[i][3]==id_temp[0][3])
{

Serial.print("your card no :");
for(int s=0;s<4;s++)
{
Serial.print(rfid.uid.uidByte[s]);
Serial.print(" ");
}
Serial.println("\nVALID");
digitalWrite(LED_PIN,HIGH);
delay(400);
digitalWrite(LED_PIN,LOW);
Sending_To_DB();
j=0;
rfid.PICC_HaltA(); rfid.PCD_StopCrypto1(); return;
}
}
}
}
else
{j++;
if(j==No_Of_Card)


{
Serial.println("inVALID");
digitalWrite(LED_CIN,HIGH);
delay(400);
digitalWrite(LED_CIN,LOW);

//Sending_To_DB();
j=0;


}
}
}
// Halt PICC
rfid.PICC_HaltA();
// Stop encryption on PCD
rfid.PCD_StopCrypto1();
}
void Sending_To_DB() //CONNECTING WITH MYSQL
{ 
if (client.connect(server,80)) {
Serial.println("connected");
// Make a HTTP request:
Serial.println("GET miniprojet/rfid/rfid_read.php?allow="); //YOUR URL/rfid/rfid_read.php?allow

client.print("GET /rfid/nodemcu_rfid/rfid_read.php?allow="); //YOUR URL/rfid/rfid_read.php?allow /var/www/html/rfid/rfid_read.php

if(j!=No_Of_Card)
{
Serial.println('1');
client.print('1');
}
else
{
Serial.println('0');
client.print('0');
}
Serial.println("&id=");
client.print("&id=");
for(int s=0;s<4;s++)
{
Serial.println(rfid.uid.uidByte[s]);
client.print(rfid.uid.uidByte[s]);
}
client.print(" "); //SPACE BEFORE HTTP/1.1
client.print("HTTP/1.1");
client.print("Host: ");
client.println(server);
client.println("Host:  192.168.5.8");
client.println("Connection: close");
client.println();
} else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
client.stop();
}
Serial.println("GET miniprojet/rfid/rfid_read.php?allow="); //YOUR URL/rfid/rfid_read.php?allow

client.print("GET /rfid/nodemcu_rfid/rfid_read.php?allow="); //YOUR URL/rfid/rfid_read.php?allow /var/www/html/rfid/rfid_read.php

Why do your Serial and client print() statements not match?

client.print("Host: ");
client.println(server);
client.println("Host:  192.168.5.8");

How many Host statements are needed?

Why are you COMPLETELY ignoring what the server has to say? I suppose you’ll ignore us, too.

If you are running your own Apache server, why are you not looking at the log files it produces. Perhaps a clue-by-four would whack you, if you did.

Serial and client print() statements to read the php files that are responsible for transmiting data to database at localhost , and i'm not used to electronic cards it's my first project using nodemcu, and i really need help please i don't know what to do, i've just found these statements on internet and i've tried to put things together, the rfid code does work but it seems that i can't connect to the server, and i have no idea why
it always say connection failed

Serial and client print() statements to read the php files that are responsible for transmiting data to database at localhost

You clearly haven't a clue what localhost means, so stop using that term.

but it seems that i can't connect to the server, and i have no idea why
it always say connection failed

Why didn't you say THAT in the first place?

Can you connect to 192.168.5.8 from another PC in the 192.168.5.n subnet?

I
tried
again
to
read
your
code,
but
I gave
up.

Use Tools + Auto Format to properly indent your code.

thanks for your time, i appreciate it