1<?php
2/**
3 * https://birdie0.github.io/discord-webhooks-guide/structure/embed/color.html
4 */
5
6$conf = array();
7include "../conf/default.php";
8
9function send_embeds($webhook, $version)
10{
11    $title = "This is a title.";
12    $color = hexdec("00cccc");
13    $url = "https://github.com/zteeed/dokuwiki-discord-notifier";
14    $description = "*Hi!* **Wow!** I can __use__ hyperlinks and star this project [here]($url).";
15    $footer = array("text" => "Dokuwiki discordnotifier $version");
16
17    // format POST data
18    $payload = array("embeds" =>
19        array(
20            array("title" => $title, "color" => $color, "description" => $description, "footer" => $footer)
21        ),
22    );
23    $json = json_encode($payload);
24    print_r($json);
25    // init curl
26    $ch = curl_init($webhook);
27    // submit payload
28    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
29    curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
30    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
31    curl_exec($ch);
32    // close curl
33    Curl_close($ch);
34}
35
36$webhook = $conf['webhook'];
37$version = $conf['notify_version'];
38send_embeds($webhook, $version);
39