Payament
Free Photos
WordPress Themes

Get the current page URL using PHP

<?php // Check the server protocol used $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https'? 'https://' : 'http://'; // get the URL with protocol $self_url = $protocol . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; // print the URL echo $self_url; ?>
This is a code snippet to get the current page URL using PHP.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.