Alvar
Alvar

Reputation: 262

How do I acquire the pagekey I put in header location?

I have a header redirect that's header("Location: http://mywebsite.com/folder/PAGEKEY"); Where PAGEKEY is a random generated key that looks like this: z4k4IKCL.

My questions is how can I acquire the key from the address? I need to be able to link to the URL and can't rely on information used on the previous page.

the key will be used to query a MYSQL database.

Upvotes: 1

Views: 117

Answers (2)

Mihai
Mihai

Reputation: 26804

$url =$_SERVER['REQUEST_URI']

$parts = explode("/", $url);

$pagekey = $parts[2]; 

Upvotes: 2

RiggsFolly
RiggsFolly

Reputation: 94682

You could use $_SERVER['REQUEST_URI']

This gives you everything on the url after the http://mywebsite.com part of the url.

Upvotes: 0

Related Questions