Collegesucks.Com Mike wrote:
Quick question...

I parse domains in my scripts like this to get the .domain.com out of www.domain.com. However, if someone visits my site with just domain.com in the url, I get .com back as the parsed domain. How can I make it so I aways get the .domain.com no matter what they use?

Here is an example of what I use now...


$parseddomain = preg_replace('/.+?(\..+)/', '$1', $domain);


this should do it:
$parseddomain=preg_replace('/.*?([^.]*\.[^.]*)/','\\1',$domain);


Kae


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to