Tuesday, May 17, 2011

Get Server Protocol in PHP

/* function return the Server protocol .. http or https based on the Server Settings */
function getServerProtocol() {
  if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
    $protocol = "https";
  } else {
    $protocol = "http";
  }
  return $protocol;
}

No comments:

Post a Comment

Followers