В общем сравнение $fp2 с входящим не работает, почему?
$fp = stream_socket_client("ssl://site.test:9555", $errstr, $errno, 30, STREAM_CLIENT_CONNECT, $context);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
echo "true\n";
fwrite($fp, "GET / HTTP/1.1\r\n" .
"Host: site.test\r\n" .
"Accept: */*\r\n" .
"Sec-WebSocket-Key: qwerty123\r\n" .
"Connection: Upgrade\r\n" .
"Upgrade: websocket\r\n\r\n");
while (!feof($fp)) {
$fp2 = trim(fgets($fp, 1024));
var_dump(serialize($fp2));
if ($fp2 == '"osada"') {
echo '!!!';
}
}
fclose($fp);
echo('close');
}
результат:
string(14) "s:7:"osada";"