Skip to content

Instantly share code, notes, and snippets.

@krll-k
Created September 9, 2012 16:59
Show Gist options
  • Save krll-k/3685660 to your computer and use it in GitHub Desktop.
Save krll-k/3685660 to your computer and use it in GitHub Desktop.
Авторизация и получение прав
/**
*Авторизация и получение прав
*/
function first_function() {
$authorize = 'http://oauth.vk.com/authorize?'.http_build_query(array(
'client_id' => $api_id,
'scope' => $scope,
'display' => $display,
'redirect_uri' => $redirect_uri));
function second_function() {
$access_get = 'https://oauth.vk.com/access_token?'.http_build_query(array(
'client_id' => $api_id,
'client_secret' => $secret_key,
'redirect_uri' => $display,
'code' => $_REQUEST['code']));
}
if (count($_REQUEST['code'])==NULL){
header("Location:".$authorize);}
else{
$access_get = file_get_contents($access_get);
print_r($access_get);
}
$access_get = json_decode($access_get);
}
/**
*Авторизация и получение прав
*/
$authorize = 'http://oauth.vk.com/authorize?'.http_build_query(array(
'client_id' => $api_id,
'scope' => $scope,
'display' => $display,
'redirect_uri' => $redirect_uri));
$access_get = 'https://oauth.vk.com/access_token?'.http_build_query(array(
'client_id' => $api_id,
'client_secret' => $secret_key,
'redirect_uri' => $display,
'code' => $_REQUEST['code']));
if (count($_REQUEST['code'])==NULL){
header("Location:".$authorize);}
else{
$access_get = file_get_contents($access_get);
print_r($access_get);
}
$access_get = json_decode($access_get);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment