Parašė tevas· 2012 Bir. 17 16:06:17
#1
Sveiki, pradejau mokytis socketus ir bandau istraukti is counter-strike 1.6 serverio informacija, informacija iseina tik is dalies istraukti, gaunu pavadinima, zemelapi, taciau niekaip negaunu max zaideju skaiciaus, skaiciaus zaidzianciu serveryje. :)
<?php
$ip = "cs.eswc.lt";
$port = "27015";
$packet = "\377\377\377\377TSource Engine Query\0";
$connect = fsockopen("udp://$ip",$port);
socket_set_timeout($connect,1);
if(!$connect) {
echo "off";
} else {
fwrite($connect,$packet);
$data = fread($connect, 1);
$status = socket_get_status($connect);
$data .= fread($connect, $status['unread_bytes']);
echo $data;
}
fclose($connect);
?>