See also: /php/page-control/get-page-uri-url

Getting Site URL

$SiteUrl = $_SERVER['SERVER_NAME'];
$SiteUrl = str_replace('www.', '', $SiteUrl);     //Remove the leading www. if present
//$SiteUrl will be 'yourdomain.co.uk' (no leading https:// )