Reputation: 3066
Hi I have URl like below
http://word.dev.net/apps/website-management?affiliate=true
now I am using $_SERVER['REQUEST_URI']
for getting current url. what I need to do to get the string affiliate=true
alone?.. please help me.
Upvotes: 0
Views: 116
Reputation: 13712
That is called a GET variable, and you can acces it via the global variable
$_GET['affiliate']
So in your code you would do something like:
if(isset($_GET['affiliate']))
/*do something with the var*/
or if you are really interested in just the string itself you can access it using the
$_SERVER["QUERY_STRING"]
global variable
Upvotes: 2
Reputation: 1231
You can combine $_SERVER['QUERY_STRING']
with parse_url
function in PHP (http://php.net/manual/en/function.parse-url.php) to get the url components.
Upvotes: 0