ругается на эту строчку $token = json_decode(file_get_contents('
https://oauth.vk.com/access_token' . '?' . urldecode(http_build_query($params))), true);
Не могу понять как реализовать ?
$params = array(
'client_id' => $config->client_id,
'redirect_uri' => $config->redirect_uri,
'scope' => 'email,photos',
'response_type' => 'code'
);
$data['auth'] = $url . "?" . urldecode(http_build_query($params));
if (isset($_GET['code'])) {
$result = false;
$params = array(
'client_id' => $config->client_id,
'client_secret' => $config->client_secret,
'code' => $_GET['code'],
'redirect_uri' => $config->redirect_uri,
);
$token = json_decode(file_get_contents('https://oauth.vk.com/access_token' . '?' . urldecode(http_build_query($params))), true);
if (isset($token['access_token'])) {
$params = array(
'uids' => $token['user_id'],
'fields' => 'uid,first_name,last_name,photo_100',
'access_token' => $token['access_token'],
'v' => '5.73',
);
$userInfo = json_decode(file_get_contents('https://api.vk.com/method/users.get' . '?' . urldecode(http_build_query($params))), true);
if (isset($userInfo['response'][0]['uid'])) {
$userInfo = $userInfo['response'][0];
$result = true;
}
}