note 71778 deleted from function.parse-url by nlopess
| From: | nlopess@php.net | Date: | Sun, 17 Dec 2006 19:30:29 +0000 |
| Subject: | note 71778 deleted from function.parse-url by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-120698@lists.php.net to get a copy of this message | ||
Note Submitter: thespook at example dot com
----
didn't test my version but it should be better than your library of TLD's... personally i
only pass on $HTTP_HOST to the explode-line (with '.' instead of '/') and
don't need the rest - y parse the entire uri anyways?
well, have fun with this:
function normalize_domain($uri) {
$uri = str_replace('www.','',str_replace('http://','',$uri));
if(!strstr($uri,'/')) return $uri;
$DOMAIN_ARRAY = explode('/',$uri);
return $DOMAIN_ARRAY[0];
}