Using Php I would like to extract the current Url of a page including all variables attached to it.
$_SERVER[‘PHP_SELF’] only return the url without the variable . any idea what function I need.
example : http://www.site.com/?v1=xyz&v2=123
using $_SERVER[‘PHP_SELF’] I get only : http://www.site.com as opposed to the whole url.
using $_GET[] individually is not an opton since I am not sure what variable are attached to the URL.
thank you
You could output the content of the
$_SERVERsuper-global variable : there are many interesting things in there 😉For example, calling a page with an URL like this :
And using :
I get at least :
In there, I suppose at least those could interest you :
$_SERVER['QUERY_STRING']: contains the whole query string ; i.e. the list of all parameters and their values$_SERVER['REQUEST_URI']: contains the requested URI — including the parameters