If you are a developer, ex : joomla developer, sometimes you need the script for get current URL.
This PHP works on all PHP versions.
I use this "PHP Get URL" on my joomla module, Blogo PageRank and Alexa Data.
If you want to make joomla module which visitor can submit your oage to social bookmarking, you use this script.
{xtypo_code}<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
{/xtypo_code}
and then, add this script to get current URL :
{xtypo_code}<?php
echo curPageURL();
?>
{/xtypo_code}
Now you can get current URL.
Coming up, PHP Get SIteName