RE: [PHP] Getting domain out of a URL
| From: | Jay Blanchard | Date: | Wed, 17 Jan 2007 20:35:34 +0000 |
| Subject: | RE: [PHP] Getting domain out of a URL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-247261@lists.php.net to get a copy of this message | ||
[snip]
I receive posts from an open moderated forum that need to be filtered
for
urls. I've successfully managed to trap any entires that use 'http://'
'www.'
with the standard '.com' '.org', '.net' endings.
What I need to do is to strip the prefix part ('http:// or http://www.
or
'www') and suffix as well (the .com, etc.) I need only the domain name.
I
can't seem to trim away the suffix part.
[/snip]
Have you looked at http://us3.php.net/manual/en/function.parse-url.php