Hoàng Lê
Hoàng Lê

Reputation: 3

I can't get value in URL | PHP

URL ex: gamob.net/token?#access_token=EAAKJnZAm

Code PHP: eg 1:

$token = $_GET['access_token'];
echo $token;

eg 2:

$token = $_GET['#access_token'];
echo $token;

eg 3:

$token =  $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
echo $token;

All can't get value in Url. Thank you!

Upvotes: 0

Views: 1181

Answers (2)

Steven Pelakova
Steven Pelakova

Reputation: 56

The variable # can only be retrieved by Javascript.

Look this exemple: how to save facebook access token after success

Upvotes: 2

m.nachury
m.nachury

Reputation: 992

I think the char # is reserved to mark anchor.

I have never seen it in GET parameters

try this ex url : gamob.net/token?access_token=EAAKJnZAm

And acces the param like that : $_GET['access_token'];

Also ?is to mark the beginning of the params and & separation between parametres

Upvotes: 4

Related Questions