V
V
Vanya Mironov2018-11-07 00:36:27
In contact with
Vanya Mironov, 2018-11-07 00:36:27

Can someone tell me why not like?

here is the script, it does not like the entry in the group in the database, everything is fine and the connection works

<?php
      include($_SERVER['DOCUMENT_ROOT'].'/data/connect.php');

  $sql1 = $mysqli->query('SELECT * FROM `sms_bot`');
    while($db = $sql->fetch_array()) {
    
    $id = $db['id']; 
    $user = $db['user_id']; // ПРОФИЛЬ ID
    $token = $db['token']; // ACCESS_TOKEN

  $method = 'https://api.vk.com/method/';
  $v = '&v=5.52';
  
    /*   НЕ СТРОЙ ИЗ СЕБЯ ПРАГРАМИСТРА, внизу нечего не трогай   */
    $group = random(array( '167796023','124126025'));
    $pin = json_decode(file_get_contents("{$method}wall.get?owner_id=-{$group}&count=2&filter=owner{$v}"), true)[response][items][0][is_pinned];
    $wallGet = json_decode(file_get_contents("{$method}wall.get?owner_id=-{$group}&offset={$pin}&count=2&filter=owner"), true)[response][1][id];
    $Liked = json_decode(file_get_contents("{$method}likes.isLiked?type=post&owner_id={$group}&item_id={$wallGet}{$v}&access_token={$token}"), true)[response][liked];
    if('0' == $Liked) { echo $likesAdd = file_get_contents("{$method}likes.add?type=post&owner_id=-{$group}&item_id={$wallGet}&access_token={$token}"); }
}
    function random($my_rand) {
  $random = mt_rand(0,count($my_rand)-1); 
  return $my_rand[$random]; 
}
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2018-11-07
@Eugeny1987

Do you have access to groups?
API enabled for groups?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question