Answers for "get site url with protocol in php"

PHP
0

get site url with protocol in php

function siteURL() {
  $protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || 
    $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
  $domainName = $_SERVER['HTTP_HOST'];
  return $protocol.$domainName;
}
Posted by: Guest on September-16-2021

Browse Popular Code Answers by Language