I\'m trying to send a message to a Python socket using PHP and that it prints the message.
Here is the PHP code so far:
$host = \"localhost\";
Try the following:
import socket
s = socket.socket()
host = "localhost"
port = 12345
s.bind((host, port))
s.listen(5)
while True:
c, addr = s.accept()
data = c.recv(1024)
if data: print data
c.close()
The main problem is your code was calling s.recv() when it should have been on c.recv(). Also make sure you check the data received (is it None?) before printing.