I have a website in Zend framework. Here I want to identify whether the current URL contains HTTPS or HTTP? I have used the following code
if($_SERVER['HTTPS']==on){ echo "something";}else{ echo "something other";}
But the result is not correct. Is there is any other way to identify this? Also I have one more question. How to get complete current url (including HTTP/HTTPS) using php?
Please help me
Thanks in advance
You could use methods that are already defined in Zend Framework instead of explicitly using
$_SERVER
superglobals.To determine if the connection is HTTP or HTTPS (this code should go into your controller):
To get complete current url:
This will both check if you're using https or http and output the current url.
notice the
on
should be a string .The better way to check is
As stated in manual
you need to fix check it should be
or try following function