<?php
    
/*
        Written By Benjamin Waldher
        E-Mail: lgbr-web@laserbunny.net

        The distribution of this software is available free of charge, and comes with NO WARRANTY.
    */
    
    //Change these variables!
    
$ip "0.0.0.0";
    
$port 27015;    //This comes after the colon in the IP address, example: 67.19.248.162:27015    

    //You're done, leave the rest be
    
$fp fsockopen("udp://$ip"$port);        //Connect to the server

    
fwrite($fp,"\xFF\xFF\xFF\xFF\x54");
    
fread($fp,6);
    
$byte "A";
    
$string "";
    for(
$i 0$i 4; ){                //Retrieve the content one byte at a time
        
$byte fread($fp,1);
        if(!
ord($byte)){            //There are four strings, terminated by a null byte
            
$array[] = $string;
            
$i++;
            
$string "";
            continue;
        }
        
$string .= $byte;
    }
    print 
"<b>Name: </b>" $array[0] . "<br>\n";    //Spew it out
    
print "<b>Map:  </b>" $array[1] . "<br>\n";
    print 
"<b>Game Folder: </b>" $array[2] . "<br>\n";
    print 
"<b>Game Name:   </b>" $array[3] . "<br>\n";
    
fread($fp,2);
    echo 
"<b>Players: </b>" ord(fread($fp,1)) . "/" ord(fread($fp,1)) . "<br>\n";
    
fread($fp,1);
    echo 
"<b>Dedicated: </b>" . ((fread($fp,1) == "d") ? "Yes" "No")."<br>\n";
    echo 
"<b>OS: </b>" . ((fread($fp,1) == "w") ? "Windows" "Linux");
    echo 
"\n<br>\n<br><a href='"$_SERVER['PHP_SELF']."s'>Source Code</a>";
?>