How to get the full url of the Current page in PHP?

Here is the solution all of you searching for, Its very simple to get the full URL of the Current page using php $_SERVER

Copy and paste the below code and run the script so you can see the result immediately:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<?php
$CurrenURL = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
echo $CurrenURL;
?>
<?php $CurrenURL = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; echo $CurrenURL; ?>
<?php

$CurrenURL = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

echo $CurrenURL;

?>

Enjoy!

Leave a Reply

Theme: Overlay by Kaira
Agurchand