How To Get Full URL In PHP

How can I get full URL in PHP

You can try following

'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}/{$_SERVER['REQUEST_URI']}"

$_SERVER[‘HTTPS’] : returns the actual value of either empty or “on”.

$_SERVER[‘HTTP_HOST’] : Contents of the Host: header from the current request, if there is one.

$_SERVER[‘REQUEST_URI’] : The URI which was given in order to access this page; for instance, ‘/index.php’.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments