0

Need to get parameters after hash(#) just using PHP

https://app.edivo.io/alpha/1.0/callback.php#access_token=fdsfDRSgsfedfgwERvnfd

I want to get access_token=fdsfDRSgsfedfgwERvnfd from above url, only using PHP

Rahul K
  • 11
  • 4

2 Answers2

3

That part is called "fragment" and you can get it in this way:

$url=parse_url("Your URL");
echo $url["fragment"]; //This variable contains the fragment

In Java script

var type = window.location.hash.substr(1);
BhAvik Gajjar
  • 473
  • 3
  • 19
  • 1
    This would be possible if he submitted a URL with # to the parse_url function. But I assume he wants to read out the URL from the browser adress bar, where getting the part after # is not possible with PHP. – MiK Nov 12 '19 at 13:09
0

Not possible from the adress bar itself, see:

https://stackoverflow.com/a/26944636/12020068

hashtag (#...) URL parts cant be detected from PHP (server-side). For that, use JavaScript.

MiK
  • 918
  • 4
  • 16