Answer the question
In order to leave comments, you need to log in
How to get Callback API attachments correctly?
I receive data. If this is a sticker, then you need to delete it, and it deletes all attachments (pictures, videos, documents).
How to check if it's a sticker?
case 'wall_reply_new':
echo 'ok';
// Полуаем данные комментария
$comment_id = $data->object->id;
$post_owner_id = $data->object->post_owner_id;
$text = mb_strtolower($data->object->text);
$from_id = $data->object->from_id;
$group_id = $data->group_id;
// Если в базе 1, то удаляем
if($cal['del_comment_sticker'] == 1) {
// Если это стикер, удаляем коммент
if(isset($data->object->attachments) && $data->object->attachments[0]->type == "photo") {
$request_params = array(
'owner_id' => $post_owner_id,
'comment_id' => $comment_id,
'access_token' => $user['token'],
'v' => $v
);
$url = 'https://api.vk.com/method/wall.deleteComment';
$requestpost = file_get_contents($url, false, stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query($request_params)
)
)));
}
}
if($cal['del_comment_wall'] == 1) {
// Проверяем на наличие ключевых слов
$key_text = explode(",", mb_strtolower($cal['key_text']));
$key_array = array_merge($key_text);
foreach($key_array as $k) {
if($k == $text) {
$request_params = array(
'owner_id' => $post_owner_id,
'comment_id' => $comment_id,
'access_token' => $user['token'],
'v' => $v
);
$url = 'https://api.vk.com/method/wall.deleteComment';
$requestpost = file_get_contents($url, false, stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query($request_params)
)
)));
if($user['user_black_list'] !== 0) {
$ban3 = json_decode(file_get_contents("https://api.vk.com/method/groups.ban?group_id={$group_id}&owner_id={$from_id}&end_date={$timestamp}&reason={$cal['comment_user_cause']}&comment={$comment_ban}&comment_visible=1&access_token={$cal['token_user']}&v={$v}"), true);
}
}
}
}
break;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question