function send_vk($vk_id, $text_source)
{
//Токен
$VKclientTokenMessages = config('app.VKclientTokenMessages');
$url="https://api.vk.com/method/messages.send?user_id=".$vk_id."&v=5.76&access_token=".$VKclientTokenMessages;
$text=rawurlencode($text_source);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, "&message=".$text);
$hh=curl_exec($ch);
//если отправка не удалась
if (!strpos(" ".$hh,'{"response":'))
{
//если нет сообщения об ошибке, отправляем повторно
if (!strpos(" ".$hh,'error')) {$hh=curl_exec($ch);}
}
$html=$hh;
curl_close($ch);
return $html;
}