Answer the question
In order to leave comments, you need to log in
How to get a parameter with a variable value from JSON using PHP?
VK has a way to get a community key Authorization Code Flow , I get a temporary access code (no problem), I get a community token using this code. The JSON type is {"access_token_XXXXXX":"токен", "expires_in":0}
where XXXXXX is the community ID for which we are getting the token.
and as soon as it comes to displaying this token on the screen, the question arises, how will I display it ?? After all, the parameter where the token is located can have different XXXXXX values depending on the community for which it was received, and display it using the command
$group_token = $request_token->response[0]->access_token;
will no longer come out because of this notorious XXXXXX in the access_token_XXXXXX parameter. How to do it?? Or is it impossible??
Answer the question
In order to leave comments, you need to log in
you also have the id of the community for which you are requesting a token.
$group_id = '( . )( . )';
$array_key = 'access_token_' . $group_id;
$group_token = $request_token->response[0][$array_key];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question