Answer the question
In order to leave comments, you need to log in
VK api SDK problem with plug-in function addresses, how to solve?
I connected the VK api SDK, it was convenient at first sight, but I ran into a problem!
According to the idea, I just needed to include autoload.php and enjoy the finished solution.
As a result, it turned out that the functions are not loaded automatically and in order to use the SDK in each file, for each function and / or class, you need to sculpt a third leg.
It should be:
$vk = new VKApiClient(VER);
$oauth = new VKOAuth();
$client_id = API_CLIENT_ID;
$redirect_uri = REDIR;
$display = VKOAuthDisplay::PAGE;
$scope = array(VKOAuthUserScope::WALL,
VKOAuthUserScope::GROUPS,
VKOAuthUserScope::EMAIL,
VKOAuthUserScope::STATS,
VKOAuthUserScope::OFFLINE
);
$browser_url = $oauth->getAuthorizeUrl(VKOAuthResponseType::CODE, $client_id, $redirect_uri, $display, $scope, $state);
$vk = new \VK\Client\VKApiClient(VER);
$oauth = new \VK\OAuth\VKOAuth();
$client_id = API_CLIENT_ID;
$redirect_uri = REDIR;
$display = \VK\OAuth\VKOAuthDisplay::PAGE;
$scope = array(\VK\OAuth\Scopes\VKOAuthUserScope::WALL,
\VK\OAuth\Scopes\VKOAuthUserScope::GROUPS,
\VK\OAuth\Scopes\VKOAuthUserScope::EMAIL,
\VK\OAuth\Scopes\VKOAuthUserScope::STATS,
\VK\OAuth\Scopes\VKOAuthUserScope::OFFLINE
);
$browser_url = $oauth->getAuthorizeUrl(\VK\OAuth\VKOAuthResponseType::CODE, $client_id, $redirect_uri, $display, $scope, $state);
use \VK\OAuth\VKOAuth;
use \VK\OAuth\ResponseType;
use \VK\Exceptions\VKClientException;
use \VK\Exceptions\VKOAuthException;
use \VK\OAuth\Scope\VKOAuthUserScope;
...
...
$vk = new VKApiClient(VER);
$oauth = new VKOAuth();
$client_id = API_CLIENT_ID;
$redirect_uri = REDIR;
$display = VKOAuthDisplay::PAGE;
$scope = array(VKOAuthUserScope::WALL,
VKOAuthUserScope::GROUPS,
VKOAuthUserScope::EMAIL,
VKOAuthUserScope::STATS,
VKOAuthUserScope::OFFLINE
);
$browser_url = $oauth->getAuthorizeUrl(VKOAuthResponseType::CODE, $client_id, $redirect_uri, $display, $scope, $state);
$UserInfo = $vk->Users()->get($UserToken['access_token'], array(
'user_ids' => $UserToken['user_id'],
'access_token' => $UserToken['access_token'],
));
Answer the question
In order to leave comments, you need to log in
If we are talking about the scope parameter, which needs to be collected manually, then this is intended, since this is a set of access rights that will be available for your Oauth session.
In the same way, as for a large number of connections, it's time to write a class that will do it itself every time it is needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question