Re: extract domain name from a URL

From: Date: Thu, 03 Oct 2002 00:49:40 +0000
Subject: Re: extract domain name from a URL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118689@lists.php.net to get a copy of this message
I think parseurl() does what you want... it's in the manual (surprise surprise!!) http://php.net/parseurl Justin on 03/10/02 5:18 AM, Joseph Szobody (jszobody@excite.com) wrote: > Folks, > > I want to keep track of referers to my site. I want to store the domain name > of the referer in a db field. I want 'just' the domain name, not the full url. > > So I need a snippet of code that could parse the $HTTP_REFERER, and return > just the domain name. > > Example.... > > 1) http://www.google.com > 2) http://www.google.com/ > 3) http://www.google.com/search?sourceid=navclient&q=evil+microsoft -º. > KÞLYt�¤j¹L > > ... would all give me http://www.google.com > > Could anyone give me a hand? Thanks!

« previous php.general (#118689) next »