I need get current url (url can be different), I want send this url to email by ajax form, but I cant get right url. I use:
echo $_GET['ref']
But it return empty value.
Addition: I have ajax form which send some data (including current url) to my email. Yes, I use this 2 values:
$url1 = $_SERVER['HTTP_HOST'];
$url2 = $_SERVER['REQUEST_URI'];
But it return me url like this:
/cloud/abuse/abuse_mailer.php
not my current URL.
$_GET
is an array containing data passed through a GET request method. If you want to get your current URL, then you can use $_SERVER
; it contains server and request data. As an example:
echo $_SERVER['REQUEST_URI']; // outputs current URI of client
Or you can try:
echo $_SERVER['PHP_SELF'];