1<?php
2 //also works with discord
3//2021 current working model
4$url = "https://guilded.gg/0000000/ABCDEFGH....";
5// security issue with this being false not tested ?? curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
6$hookObject = json_encode([
7 /*
8 * The general "message" shown above your embeds
9 */
10 "content" => "A message will go here",
11 /*
12 * The username shown in the message
13 */
14 "username" => "MyUsername",
15 /*
16 * The image location for the senders image
17 */
18 "avatar_url" => "https://pbs.twimg.com/profile_images/972154872261853184/RnOg6UyU_400x400.jpg",
19 /*
20 * Whether or not to read the message in Text-to-speech
21 */
22 "tts" => false,
23 /*
24 * File contents to send to upload a file
25 */
26 // "file" => "",
27 /*
28 * An array of Embeds
29 */
30 "embeds" => [
31 /*
32 * Our first embed
33 */
34 [
35 // Set the title for your embed
36 "title" => "Google.com",
37
38 // The type of your embed, will ALWAYS be "rich"
39 "type" => "rich",
40
41 // A description for your embed
42 "description" => "",
43
44 // The URL of where your title will be a link to
45 "url" => "https://www.google.com/",
46
47 /* A timestamp to be displayed below the embed, IE for when an an article was posted
48 * This must be formatted as ISO8601
49 */
50 "timestamp" => "2018-03-10T19:15:45-05:00",
51
52 // The integer color to be used on the left side of the embed
53 "color" => hexdec( "FFFFFF" ),
54
55 // Footer object
56 "footer" => [
57 "text" => "Google TM",
58 "icon_url" => "https://pbs.twimg.com/profile_images/972154872261853184/RnOg6UyU_400x400.jpg"
59 ],
60
61 // Image object
62 "image" => [
63 "url" => "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
64 ],
65
66 // Thumbnail object
67 "thumbnail" => [
68 "url" => "https://pbs.twimg.com/profile_images/972154872261853184/RnOg6UyU_400x400.jpg"
69 ],
70
71 // Author object
72 "author" => [
73 "name" => "Alphabet",
74 "url" => "https://www.abc.xyz"
75 ],
76
77 // Field array of objects
78 "fields" => [
79 // Field 1
80 [
81 "name" => "Data A",
82 "value" => "Value A",
83 "inline" => false
84 ],
85 // Field 2
86 [
87 "name" => "Data B",
88 "value" => "Value B",
89 "inline" => true
90 ],
91 // Field 3
92 [
93 "name" => "Data C",
94 "value" => "Value C",
95 "inline" => true
96 ]
97 ]
98 ]
99 ]
100
101], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
102
103$headers = [ 'Content-Type: application/json; charset=utf-8' ];
104$POST = [ 'username' => 'Testing BOT', 'content' => 'Testing message' ];
105
106$ch = curl_init();
107curl_setopt($ch, CURLOPT_URL, $url);
108curl_setopt($ch, CURLOPT_POST, true);
109curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
110curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
111curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
112curl_setopt($ch, CURLOPT_POSTFIELDS, $hookObject);
113$response = curl_exec($ch);