Skip to content

Instantly share code, notes, and snippets.

@gluschenko
Last active June 4, 2017 22:36
Show Gist options
  • Save gluschenko/378f86536fc64a7bdfe9ab0d12bbc82f to your computer and use it in GitHub Desktop.
Save gluschenko/378f86536fc64a7bdfe9ab0d12bbc82f to your computer and use it in GitHub Desktop.
<?php
$api_id = 1;
$api_secret = "APP_SERVICE_TOKEN";
$message_text = "Test";
$current_users_list = array();
$current_offset = 0;
function Send()
{
global $current_users_list;
global $current_offset;
global $api_id;
global $access_token;
global $message_text;
$current_users_list = array();
$query = mysql_query("SELECT `id` FROM `users` LIMIT ".$current_offset.", 100");
while($row = mysql_fetch_assoc($query))
{
$current_users_list[] = $row['id'];
}
$current_offset += sizeof($current_users_list);
//
file_get_contents("https://api.vk.com/method/secure.sendNotification?user_ids=".implode(",", $current_users_list)."&message=".$message_text."&client_id=".$api_id."&client_secret=".$api_secret);
if(sizeof($current_users_list) != 0)Send();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment