Possible Duplicate:
Parsing Domain From URL In PHP
How do I parse a URL in PHP?
I have this code:
$url = preg_replace("/^(http:\/\/)*(www.)*/is", "", $url);
$url = preg_replace("/\/.*$/is" , "" ,$url);
It work good get domain name where after .com is / . I got problem if there is url like this:
http://www.something.com?id=21213
What do I need to add to regex to cut ?id=21213 so there remains only something.com