href="https://api.vk.com/method/messages.send?user_ids= <?php echo $row['nums'];?> &message=<?php echo $row['text']; ?> &v=5.37&access_token=<?php echo $row['token']; ?> 
  • NUMS are user IDs.
  • text - text to send
  • token - api vk token

Why can I send one person, and several - no?

    2 answers 2

    The user_ids parameter in messages.send is available only when sending messages in group dialogs on its behalf, and your access_token is apparently created on behalf of the user.

      Wouldn't it be easier to do that?

       $idsFile = __DIR__ . '/user_id.txt'; //Файл с ID $idsStr = file_get_contents($idsFile); $ids = array_filter(explode("\n", $idsStr)); //разбиваем ID foreach ($ids as $value) {$messages_send = array( //Перебираем ID и отправляем на все сообщение. 'message' => "Hello World", 'user_id' => $value, 'access_token' => $access_token, 'v' => '5.0'); $get = http_build_query($messages_send); file_get_contents('https://api.vk.com/method/messages.send?'.$get); } 

      Ps. You lost foreach somewhere =)