10-08-2008, 08:38 PM
Ever wanted to extract the domain name from a long URL? Here is a simple code that will do this.
Code:
$url='http://www.webdomainsbroker.com/forum/webdesign-and-coding/';
if (isset($url)) {
$ref = parse_url($url);
$uri = trim(eregi_replace('www.', '', $ref['host']));
echo $uri;
}