D
D
Danil Zhdanov2019-03-17 20:45:19
API
Danil Zhdanov, 2019-03-17 20:45:19

What is wrong with VK?

Guys, what is the reason? put the auto status script. and gave an error: Response GetMessages
Array
(
[error] => Array
(
[error_code] => 15
[error_msg] => Access denied: no access to call this method
[request_params] => Array
(
[0] => Array
(
[ key] => oauth
[value] => 1
)
[1] => Array
(
[key] => method
[value] => messages.get
)
[2] => Array
(
[key] => lang
[value] => ru
)
[3] => Array
(
[key] => v
[value] => 3.0
)
[4] => Array
(
[key ] => count
[value] => 1
)
)
)
)
GetDialogs response
the code itself

<?php


$access_token = '79db22f21e391d2cf19f091324f39ef21a04b05e604240502d6be8222845cf0c46dc8320d1bc9f';

// ====================================
// Устанавливаем время: Украина - Europe/Kiev ; Россия - Europe/Moscow
// ====================================
 date_default_timezone_set ('Europe/Moscow');

// ============[WARNING!]==============
// Дальше не советую трогать что-либо.|
// ============[WARNING!]==============

$time1 = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
$time2 = array('1⃣', '2⃣', '3⃣', '4⃣', '5⃣', '6⃣', '7⃣', '8⃣', '9⃣', '0⃣');
$time = str_replace($time1, $time2, date("H:i"));

$date1 = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
$date2 = array('1⃣', '2⃣', '3⃣', '4⃣', '5⃣', '6⃣', '7⃣', '8⃣', '9⃣', '0⃣');
$date = str_replace($date1, $date2, date("d.m"));

$RequestsGet = curl('https://api.vk.com/method/users.get?user_ids='.$tvoiID.'&fields=online&name_case=Nom&access_token='.$access_token);
$json1 = json_decode($RequestsGet,1);
$countR = $json1[response][0][online_mobile];
$countD = $json1[response][0][online];

$online2 = array(
    0 => 'Я &#128564;', 1 => 'Я с &#128187;'
);
$online = array(
    1 => 'Я с &#128242;'
);
if ($countR == 1) {
$answer="$online[$countR]";
} else {
$answer="$online2[$countD]";
}

$getLikes = curl('https://api.vk.com/method/photos.get?album_id=profile&rev=1&extended=1&count=1&access_token='.$access_token.'&v=3.0');
$getLikesJson = json_decode($getLikes,1);
$likes = $getLikesJson['response']['0']['likes']['count'];

$список_блоченных = curl('https://api.vk.com/method/account.getBanned?access_token='.$access_token);
$json = json_decode($список_блоченных,1);
$колво_в_чс = $json['response']['0'];

  $getMessages = curl('https://api.vk.com/method/messages.get?lang=ru&v=3.0&count=1&access_token='.$access_token);
  $getMessagesJson = json_decode($getMessages,1);
  echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />Ответ GetMessages<pre>";
  print_r($getMessagesJson);
  echo "</pre><hr>";
  echo "Ответ GetDialogs<pre>";
  print_r($getDialogsJson);
  echo "</pre><hr>";
  settype($userIdLastMessage, 'array');
  settype($userIdLastMessage, 'array');
  $userIdLastMessage = $getMessagesJson['response']['1']['uid'];
  $getDataOfLastUser = curl('https://api.vk.com/method/users.get?lang=ru&v=3.0&user_ids='.$userIdLastMessage.'&name_case=gen&access_token='.$access_token);
  $getDataOfLastUserJson = json_decode($getDataOfLastUser,1);
  $lastUserName = $getDataOfLastUserJson['response']['0']['first_name'];
  $lastUserSurname = $getDataOfLastUserJson['response']['0']['last_name'];
  
$smiles = array("", "", "","", "", "", "", "","", "", "", "", "");
$smiles2 = array("", "", "","", "", "", "", "","", "", "", "", "");
$rand = rand(0,count($smiles) - 1); 
$rand2 = rand(0,count($smiles) - 1); 
$rand3 = rand(0,count($smiles2) - 1);  
$smail = $smiles2[$rand]; 
$smail2 = $smiles2[$rand2];
$smail3 = $smiles[$rand3]; 

// ========================================
//        Самое вкусное - СТАТУС!        |
// ========================================
$status = '|&#8987;|'.$time.' ('.$smail2.') На аве:'.$likes.'❤ ('.$smail.')&#13; |&#128197;|'.$date.' Последнее ✉ от '.$lastUserName.' '.$lastUserSurname.' | ⛔В чс: '.$колво_в_чс.' | '.$answer.' | ('.$smail3.')';
$Status = curl('https://api.vk.com/method/status.set?text='.urlencode($status).'&access_token='.$access_token);

function curl( $url ){
    $ch = curl_init( $url );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
    curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
    $response = curl_exec( $ch );
    curl_close( $ch );
    return $response;
}
?>

PS code is not mine

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max Payne, 2019-03-17
@XpaHuTeJIb

First, messages.get has been deprecated a long time ago. Secondly, Messages.API is recently closed to custom pages.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question