# Getting a PHP Parameter when it's # instead of?

**URL:** <https://www.phphelp.com/t/getting-a-php-parameter-when-its-instead-of/33414>\
**Category:** General PHP Help\
**Created:** [April 28, 2021, 4:54pm UTC](https://www.phphelp.com/t/getting-a-php-parameter-when-its-instead-of/33414 "2021-04-28T16:54:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DonovanTheDeveloper](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/bc8723/32.png) [@DonovanTheDeveloper](https://www.phphelp.com/u/DonovanTheDeveloper)\
**Post date:** [April 28, 2021, 4:54pm UTC](https://www.phphelp.com/t/getting-a-php-parameter-when-its-instead-of/33414/1 "2021-04-28T16:54:40Z")

</div>

Hello! My name is Donovan and I’m learning PHP. I’m using the Yandex OAuth API to check if they have an email at `@mail.(my domain)` through Yandex360.

The problem: I need to extract the token from this URL in PHP.  
`https://mail.(my domain)/auth/server.php#access_token=TOKENGOESHERE&token_type=TYPE&expires_in=EXPIRATION`  
I want to get `TOKENGOESHERE` from the URL in PHP to connect to the Yandex API to check the email on the account. How can I get `TOKENGOESHERE` from the URL?

---

<div class="post-metadata">

**Author:** ![ErnieAlex](https://www.phphelp.com/letter_avatar_proxy/v4/letter/e/bc8723/32.png) [@ErnieAlex](https://www.phphelp.com/u/ErnieAlex)\
**Post date:** [April 28, 2021, 5:25pm UTC](https://www.phphelp.com/t/getting-a-php-parameter-when-its-instead-of/33414/2 "2021-04-28T17:25:11Z")

</div>

> [@DonovanTheDeveloper](#):
>
> [https://mail](https://mail).(my domain)/auth/server.php#access\_token=TOKENGOESHERE&token\_type=TYPE&expires\_in=EXPIRATION

This needs a ? instead of a #. # means to show the page starting at a bookmark. Something loosely like: URL?access\_token&token\_type&expires\_in  
When you create the value, to send to the second page, it would be something like:  
$url=“auth/server.php?” . $access\_token . “&” . $token\_type . “&” . $expires\_in ;  
You may need to add quotes around type and expires if they are strings, same for token, too.  
And, then, in the server.php file, you retrieve these using GET. Something loosely like this:  
$access\_token=filter\_input(INPUT\_GET, “access\_token”);  
$token\_type=filter\_input(INPUT\_GET, “token\_type”);  
$expires\_in=filter\_input(INPUT\_GET, “expires\_in”);

Now, this is just the basics. I am not familiar with the Yandex API, but, this is how you would pass data from page to page in normal PHP files. You might be able to find more thru the Yandex docs themselves.

---

<div class="post-metadata">

**Author:** ![DonovanTheDeveloper](https://www.phphelp.com/letter_avatar_proxy/v4/letter/d/bc8723/32.png) [@DonovanTheDeveloper](https://www.phphelp.com/u/DonovanTheDeveloper)\
**Post date:** [April 28, 2021, 6:41pm UTC](https://www.phphelp.com/t/getting-a-php-parameter-when-its-instead-of/33414/3 "2021-04-28T18:41:54Z")

</div>

Thanks for the response!  
Using the Yandex API, it always is reporting `https://mail.(my domain)/auth/server.php#access_token=TOKENGOESHERE&token_type=TYPE&expires_in=EXPIRATION` and I cannot change this (this is where I’m redirected once I use the OAuth URL). I am wondering if there’s away I can get `TOKENGOESHERE` with this link base. I’m trying to find another solution, but this is all I have. I can’t find any PHP script directions on Yandex’s docs.

---

<div class="post-metadata">

**Author:** ![skawid](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@skawid](https://www.phphelp.com/u/skawid)\
**Post date:** [April 28, 2021, 7:47pm UTC](https://www.phphelp.com/t/getting-a-php-parameter-when-its-instead-of/33414/4 "2021-04-28T19:47:32Z")

</div>

Anything after the `#` in a URL is not supposed to be sent to the server at all; it’s only used by the browser. You’ll have to use javascript here.
