private function query($target, $server, $port = 43, $timeout = 5)
    {
        // Create the socket
        $sock = @fsockopen($server, $port, $errno, $errstr, $timeout);

        // Check for errors
        if (!$sock) {
            // Throw an exception with the error string
            throw new WhoisException($errstr);
        }

        // Write the target to the socket
        fwrite($sock, $target . "\r\n");

        // Create storage variable
        $response = '';

        // Await output
        while ($line = fgets($sock)) {
            $response .= $line;
        }

        // Close the socket
        fclose($sock);

        // Return the response
        return $response;
    }