forked from fnsoff/VkDiscordHook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebhook.php
More file actions
54 lines (54 loc) · 1.84 KB
/
webhook.php
File metadata and controls
54 lines (54 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
if (!isset($_REQUEST)) {
return;
}
$confirmation_token = '0f5c65fc'; // Токен подтверждения
$data = json_decode(file_get_contents('php://input'));
$lelu = json_decode(file_get_contents('php://input'), true);
switch ($data->type) {
case 'confirmation': echo $confirmation_token; break;
case 'wall_post_new':
$messageSS = $data->object->text;
$currenttime = $data->object->date;
$url = "https://discordapp.com/api/webhooks/587552493194444806/AFPqskP9cx1Zg6b8wT_-7AchyzXSQ8ldyWksgo1GCOYU-r_Py4fu4y3NUqGEZqVv_Roa"; // Веб хук
$hookObject = json_encode([
"content" => "",
"username" => "",
"avatar_url" => "",
"tts" => false,
"embeds" => [
[
"title" => "",
"type" => "rich",
"description" => "$messageSS",
"url" => "",
"timestamp" => "",
"color" => "blue",
"footer" => [
"text" => "(C) VOID • Дата: $currenttime",
"icon_url" => "https://pngicon.ru/file/uploads/vk.png"
],
"thumbnail" => [
"url" => "https://pbs.twimg.com/profile_images/972154872261853184/RnOg6UyU_400x400.jpg"
],
"author" => [
"name" => "Новая новость ВК!"
]
]
]
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
$ch = curl_init();
curl_setopt_array( $ch, [
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $hookObject,
CURLOPT_HTTPHEADER => [
"Length" => strlen( $hookObject ),
"Content-Type" => "application/json"
]
]);
$response = curl_exec( $ch );
curl_close( $ch );
break;
}
?>