I want to take in any URL as input, and output just the domain name, so no trailing slash after the .com or .co.uk etc) and also remove the www. and whatever comes before it (noting that there may not be a www.).
Examples:
http://google.com/dir1/dir2/index.php -> google.com https://www.wonderfulworld.co.uk?a=1 -> wonderfulworld.co.uk
I will be using the preg_replace
method in PHP.