What's the best way to identify subdomains by PHP dynamically?
        Posted  
        
            by kavoir.com
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by kavoir.com
        
        
        
        Published on 2010-04-11T12:41:12Z
        Indexed on 
            2010/04/11
            12:43 UTC
        
        
        Read the original article
        Hit count: 294
        
I have configured the wildcard DNS of *.mydomain.com and it's all working properly. My question is which of these should I rely on identifying client subdomain requests?
- $_SERVER["HTTP_HOST"]
- $_SERVER["SERVER_NAME"]
- $_SERVER["SCRIPT_URI"]
They all seem to contain the subdomain part I want but after reading this article by Chris: http://shiflett.org/blog/2005/feb/more-on-filtering-input-and-escaping-output, I'm lost at see and there appears to be no safe way to do this?
Any idea on accomplishing this task securely?
© Stack Overflow or respective owner