So why does college suck? Afraid of learning?

Anyway, you can solve your problem by simple parsing. An example is below.

<?php
$TheParse = "www.edmondpaper.com";
$TheNewParse = explode (".", $TheParse);
$TheTotal = count($TheNewParse);
echo ($TheNewParse[($TheTotal - 2)]);
echo (".");
echo ($TheNewParse[($TheTotal - 1)]);
?>

This will result in "edmondpaper.com"

Obviously there are ways of refining this further, but if college sucks, you might not be interested in learning more :-).



At 3:30 AM -0500 on 8/28/03, CollegeSucks.com Mike wrote:
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);

-- =========================== John T. Beresford Apple Certified Technical Coordinator http://www.deewi.com/ 405.760.0794

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



Reply via email to