Thread: Hostname Regex
View Single Post
Old 08-16-2008, 12:32 PM   #4 (permalink)
Kalle
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

You could use the parse_url() function built into PHP to fetch the domain name =)

PHP Code:
<?php
    $url 
'http://www.talkphp.com/';

    
var_dump(parse_url($url));
?>
Note, on invalid url's parse_url() will return false and throw an E_WARNING, so calling it with the error control operator prefixed (@).
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote