PHP Tutorial : Get Protocol
Jun 2, 2009 Useful PHP
I saw this problem/question on a few forums and I finded it useful to post on my blog too due to low results on google that gives you what you need. So, how to get the protocol of a URL using php? Have a look :
<?php
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))==’https’?'https’:'http’;
print “The protocol is $protocol”;
?>
Tadaaa!
Read PHP Tutorial : Get Protocol »
Tags: detect protocol, get protocol, php detect protocol, php get protocol, php protocol, protocol

