Recently I need to get the domain name from the URL. This is a small task but it is very useful stuff. In this short article, We’ll provide you simple and easy code to get the domain name from URL in PHP.
In this example, you’ll be able to get only the domain name from your current URL.
$url = "https://www.phpadvices.com";
$parse = parse_url($url);
$host = $parse['host'];
$host = str_ireplace('www.', '', $host);
Thanks for your time, to know about me.
Hello I Am Vijay Poshiya. 🙂
Here’s My little description of your attention on Me and My blog. I am here to help you with PHP programming. I can give you a cake walkthrough platform where a complex program can make it easier for you. I will also provide you with the rare collections of task sets over the internet.
I hope you will find your solutions in better understanding shape within my blog.
You can read more about PHPAdvices at the “About” page.