<?php
function get_server() {
$protocol = 'http';
if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
$protocol = 'https';
}
$host = $_SERVER['HTTP_HOST'];
$baseUrl = $protocol . '://' . $host;
if (substr($baseUrl, -1)=='/') {
$baseUrl = substr($baseUrl, 0, strlen($baseUrl)-1);
}
return $baseUrl;
}
?>
Usage:
<?php echo get_server(); ?>
Added by roScripts on April-18-2007, 3:53 pm
