For our customization want to parsing domain from URL in PHP then use the following code. Here $parse[‘host’] prints the domain name of a given URL in $url.

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

Have any doubt, then comment here!

Leave a Reply

Your email address will not be published. Required fields are marked *