PHP GET CURRENT PAGE FULL URL
<?php
function getCurrentPageUrl(){
// http or https
$protocol = isset($_SERVER["HTTPS"]) ? 'https' : 'http';
$currentPage = $protocol."://".$_SERVER['SERVER_ADDR'].$_SERVER['REQUEST_URI'];
// incase of local host server_aadr will be ::1 , so we will be replacing it
return str_replace('::1', 'localhost', $currentPage);
}
echo getCurrentPageUrl();
// Eg: https://www.thewebblinders.in/programming
getCurrentPageUrl() will give you the requested protocol, requested document path and query string parameters
ALTERNATE TITLES