Код: Выделить всё
$remote_ip = 'smth';
$remote_port = smth;
// Create a TCP socket
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
// Connect to the remote server
if (socket_connect($socket, $remote_ip, $remote_port)) {
// Data to send
$message = "Hello, this is a message from PHP!";
// Send the message
socket_write($socket, $message, strlen($message));
// Close the socket
socket_close($socket);
} else {
echo "Unable to connect to the remote server.";
}

Подробнее здесь: https://stackoverflow.com/questions/790 ... php-to-the
Мобильная версия