Send data to a pc localhost with ESP-01 wifi module
"localhost" is a name associated with the loopback interface of your computer. That is, 127.0.0.1.

It is not the address of your computer on the network. The only computer that can talk to "localhost" is the computer itself.

Instead of "localhost" you must use the IP address of your computer (or a FQDN that resolves to the IP address of your computer).

And you cannot open a TCP connection to a URL.  You open a TCP connection to an IP or FQDN.

You really should learn the basics of IP networks before trying to write software for them.



Since your PC can communicate with the ESP8266 on 192.168.4.1 I assume that you are running the ESP8266 in SOFTAP mode and you have a WiFi interface connected to that access point. If so that WiFi interface will have a 192.168.4.x address assigned to it.  That is the address you must open with a TCP connection on port 80 to connect to your apache server.

For example:

sendData("AT+CIPSTART=0,'TCP','192.168.4.3',80\r\n",1000,DEBUG);


Then you can craft a suitable HTTP request to send the data.