$url
=
"http://google.com/xxx.html?xxx=xxx"
;
preg_match(
'@^(?:http://)?([^/]+)@i'
,
$matches
);
$host
[1];
echo