Jump to: navigation, search

PHP URL PROTOCOL

From w3cyberlearnings

Contents

PHP CURRENT URL Protocol

Get current URL Protocol.

Example 1

echo $_SERVER['SERVER_PROTOCOL'];

Output

HTTP/1.1

Example 2

Check for SSL Certificate of a domain name.

$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') 
          === TRUE ? 'https' : 'http';
echo $protocol;

Output

http

Related Links

Manage URL
  1. PHP CURRENT URL
  2. PHP CURRENT HOST
  3. PHP URL Parameters
  4. PHP URL PROTOCOL
  5. PHP URL Script Name
  6. PHP FULL URL
  7. PHP URL Parent Directory
Navigation
Web
SQL
MISC
References