Re: parsing domains
| From: | David T-G | Date: | Thu, 28 Aug 2003 19:24:03 +0000 |
| Subject: | Re: parsing domains | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161076@lists.php.net to get a copy of this message | ||
Mike --
..and then CollegeSucks.com Mike said...
%
% Quick question...
Quick answer :-)
%
..
%
% $parseddomain = preg_replace('/.+?(\..+)/', '$1', $domain);
# pulls out "domain" from
# domain.com
# www.domain.com
# www.domain.ac.uk
# ...
$this_domain =
preg_replace('/(www\.)?([^\.]*).*/','\2',getenv('HTTP_HOST')) ;
Maybe college doesn't suck so much after all... ;-)
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!