note 113737 deleted from reserved.variables.server by peehaa

From: Date: Mon, 02 Dec 2013 09:30:51 +0000
Subject: note 113737 deleted from reserved.variables.server by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197715@lists.php.net to get a copy of this message
Note Submitter: Yousef Ismaeil Cliprz ---- Get current website URL <?php /** * Get current website URL * * @param boolean use WWW. or not by default true * @author Yousef Ismaeil <cliprz@gmail.com> */ function websiteUrl ($www=true) { $withW = (($www) ? 'www.' : ''); $scheme = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https' : 'http'; $url = sprintf('%s://%s%s/',$scheme,$withW,$_SERVER['HTTP_HOST']); return (string) $url; } echo websiteUrl(); // Output's = http://www.cliprz.com ?>

« previous php.notes (#197715) next »