Re: parsing domains
| From: | Tom Rogers | Date: | Thu, 28 Aug 2003 08:56:08 +0000 |
| Subject: | Re: parsing domains | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161014@lists.php.net to get a copy of this message | ||
Hi,
Thursday, August 28, 2003, 6:30:44 PM, you wrote:
CcM> Quick question...
CcM> I parse domains in my scripts like this to get the .domain.com out of www.domain.com.
CcM> However, if someone visits my site with just domain.com in the url, I get .com back as the parsed
CcM> domain.
CcM> How can I make it so I aways get the .domain.com no matter what they use?
CcM> Here is an example of what I use now...
CcM> $parseddomain = preg_replace('/.+?(\..+)/', '$1', $domain);
CcM> --
CcM> _______________________________________________
CcM> Get your free Verizonmail at www.verizonmail.com
do a str_replace('/www.','/',$parseddomain); then do your preg_replace
--
regards,
Tom