Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #site #url #protocol #php
ADD COMMENT
Topic
Name
4+9 =