php get domain name from url
snippet in php

php get domain from url

user6503

$url = 'http://google.com/dhasjkdas/sadsdds/sdda/sdads.html';
$parse = parse_url($url);
echo $parse['host']; // prints 'google.com'

php get domain name from url

user6962

parse_url('http://www.website.com/hey.php', PHP_URL_HOST);