How to Get Current Page URL in PHP
Use the PHP $_SERVER Superglobal Variable.
You can now get the current page URL using the line:
<?php
echo $link = $_SERVER[HTTP_HOST];
echo $link = $_SERVER[REQUEST_URI];
echo $link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo basename($_SERVER['PHP_SELF']);
?>
//OUTPUT
codingbuz.com
/php/test.php
http://codingbuz.com/php/test.php
test.php