Read Full URL in PHP


Here is the syntax, the Double quote is important below, this will show you your current URL


echo $FULL_URL = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

To get HTTPS Version, change code with below syntax


$FULL_URL= (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";


No comments :

Post a Comment

Leave A Comment...