Php get email and username

This doesn’t tell me if $validate_token is available to your first bit of code.

You may have wrapped the first bit in a function and not made the token available inside that function.

So might be easier to show all your code rather than parts of your code