I would like to the whole of the URL including the _GET variable names and values, for example www.mywebsite.com/store.php?department=MENS
The code I have used below only gives me the URL without the _GET variable part.
$url = $_SERVER['SERVER_NAME'];
$page = $_SERVER['PHP_SELF'];
$page = $_POST['url'];
echo "http://".$url.$page;
All I would like is to be able to copy that URL exactly how it is.
try this function
public function getURL()
{
$protocol = @$_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
taken from hre
use it like
echo getURL();
see if works for you
like this one..
$(function() {
$('.ajax-link').click( function() {
var link=$(this).attr('href');
$.post( "savedl.php",{name:link},
function(data) {
window.location.href=link;
});
return false; // don't follow the link!
});
});
sample is i have the url in the link
<a href='' class="ajax-link" id="url_name">url </a>
then you can get the value on savedl.php using $_POST['name']