( int ) $Timeout, 'usec' => 0 ) ); Socket_Set_Option ( $Socket, SOL_SOCKET, SO_RCVTIMEO, array ( 'sec' => ( int ) $Timeout, 'usec' => 0 ) ); if ($Socket === FALSE || @Socket_Connect ( $Socket, $IP, ( int ) $Port ) === FALSE) { return FALSE; } Socket_Send ( $Socket, "\xFE\x01", 2, 0 ); // Socket_Send ( $Socket, "\x0F\0x00\x04\x09\x31\x32\x37\x2E\x30\x2E\x30\x2E\x31\x63\xDD\x01", 16, 0); // Socket_Send ( $Socket, "\x01\x00", 2, 0 ); $Len = Socket_Recv ( $Socket, $Data, 1024, 0 ); Socket_Close ( $Socket ); // return FALSE; // if ($Len < 4 || $Data [0] !== "\xFF") { // return FALSE; // } // $Data = SubStr ( $Data, 3 ); echo($Len); echo("

"); // $Data = iconv( 'UTF-16BE', 'UTF-8', $Data ); print_r($Data); echo("

"); $zData = Explode ( "\x00", $Data ); echo(count($zData)); echo("

"); print_r($zData); echo("

"); $aData = Explode ( "\xA7", $Data ); echo(count($aData)); echo("

"); print_r($aData); // if ($Data [1] === "\xA7" && $Data [2] === "\x31") { // $Data = Explode ( "\x00", $Data ); // var_dump($Data [3]); // return Array ( // 'HostName' => $Data [3], // 'Players' => IntVal ( $Data [4] ), // 'MaxPlayers' => IntVal ( $Data [5] ), // 'Protocol' => IntVal ( $Data [1] ), // 'Version' => $Data [2] // ); // } // $Data = Explode ( "\xA7", $Data ); // return Array ( // 'HostName' => SubStr ( $Data [0], 0, - 1 ), // 'Players' => isset ( $Data [1] ) ? IntVal ( $Data [1] ) : 0, // 'MaxPlayers' => isset ( $Data [2] ) ? IntVal ( $Data [2] ) : 0, // 'Protocol' => 0, // 'Version' => '1.3' // ); } }