Answer the question
In order to leave comments, you need to log in
Maybe someone knows why the likes stopped showing up?
Such a problem before, likes were displayed normally, but now they are no longer displayed, can anyone know what the problem is?
<?php
include($_SERVER['DOCUMENT_ROOT'].'/data/connect.php');
$sql = $mysqli->query('SELECT * FROM `status`');
while($db = $sql->fetch_array()) {
if($db['status_id']=='4') {
date_default_timezone_set ($db['city']);
$getMessages = curl('https://api.vk.com/method/messages.getConversations?lang=ru&count=1&access_token='.$db['token'].'&v=5.77');
$getMessagesJson = json_decode($getMessages,1);
$userIdLastMessage = $getMessagesJson['response']['items'][0]['last_message']['from_id'];
$getDataOfLastUser = curl('https://api.vk.com/method/users.get?lang=ru&user_ids='.$userIdLastMessage.'&name_case=gen&access_token='.$db['token'].'&v=5.77');
$getDataOfLastUserJson = json_decode($getDataOfLastUser,1);
$lastUserName = $getDataOfLastUserJson['response']['0']['first_name'];
$lastUserSurname = $getDataOfLastUserJson['response']['0']['last_name'];
$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='.$db['user_id'].'&fields=online&name_case=Nom&access_token='.$db['token'].'&v=5.77');
$json1 = json_decode($RequestsGet,1);
$countR = $json1[response][0][online_mobile];
$countD = $json1[response][0][online];
$online2 = array(
0 => 'Я 😴', 1 => 'Я с 💻'
);
$online = array(
1 => 'Я с 📲'
);
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.'');
$getLikesJson = json_decode($getLikes,1);
$likes = $getLikesJson['response']['0']['likes']['count'];
$список_блоченных = curl('https://api.vk.com/method/account.getBanned?access_token='.$db['token'].'&v=5.77');
$json = json_decode($список_блоченных,1);
$колво_в_чс = $json['response']['count'];
$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 = '|⌛|'.$time.' ('.$smail2.') На аве:'.$likes.'❤ ('.$smail.') |📅|'.$date.' Последнее ✉ от '.$lastUserName.' '.$lastUserSurname.' | ⛔В чс: '.$колво_в_чс.' | '.$answer.' | ('.$smail3.')';
$Status = curl('https://api.vk.com/method/status.set?text='.urlencode($status).'&access_token='.$db['token'].'&v=5.77');
}}
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;
}
Answer the question
In order to leave comments, you need to log in
In the request to get the number of likes, you do not have an indication of the API version.
Just try to open two options in the browser:
a) the one you have now
b) one that will work:
Karoch, in the request for "likes" add at the end&v=5.77
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question