php discord webhook

Solutions on MaxInterview for php discord webhook by the best coders in the world

showing results for - "php discord webhook"
Anthony
05 Jun 2020
1<?php
2//2021 current working model
3$url = "https://discordapp.com/api/webhooks/0000000/ABCDEFGH....";
4// security issue with this being false not tested ?? curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
5$hookObject = json_encode([
6    /*
7     * The general "message" shown above your embeds
8     */
9    "content" => "A message will go here",
10    /*
11     * The username shown in the message
12     */
13    "username" => "MyUsername",
14    /*
15     * The image location for the senders image
16     */
17    "avatar_url" => "https://pbs.twimg.com/profile_images/972154872261853184/RnOg6UyU_400x400.jpg",
18    /*
19     * Whether or not to read the message in Text-to-speech
20     */
21    "tts" => false,
22    /*
23     * File contents to send to upload a file
24     */
25    // "file" => "",
26    /*
27     * An array of Embeds
28     */
29    "embeds" => [
30        /*
31         * Our first embed
32         */
33        [
34            // Set the title for your embed
35            "title" => "Google.com",
36            
37            // The type of your embed, will ALWAYS be "rich"
38            "type" => "rich",
39            
40            // A description for your embed
41            "description" => "",
42            
43            // The URL of where your title will be a link to
44            "url" => "https://www.google.com/",
45            
46            /* A timestamp to be displayed below the embed, IE for when an an article was posted
47             * This must be formatted as ISO8601
48             */
49            "timestamp" => "2018-03-10T19:15:45-05:00",
50            
51            // The integer color to be used on the left side of the embed
52            "color" => hexdec( "FFFFFF" ),
53            
54            // Footer object
55            "footer" => [
56                "text" => "Google TM",
57                "icon_url" => "https://pbs.twimg.com/profile_images/972154872261853184/RnOg6UyU_400x400.jpg"
58            ],
59            
60            // Image object
61            "image" => [
62                "url" => "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
63            ],
64            
65            // Thumbnail object
66            "thumbnail" => [
67                "url" => "https://pbs.twimg.com/profile_images/972154872261853184/RnOg6UyU_400x400.jpg"
68            ],
69            
70            // Author object
71            "author" => [
72                "name" => "Alphabet",
73                "url" => "https://www.abc.xyz"
74            ],
75            
76            // Field array of objects
77            "fields" => [
78                // Field 1
79                [
80                    "name" => "Data A",
81                    "value" => "Value A",
82                    "inline" => false
83                ],
84                // Field 2
85                [
86                    "name" => "Data B",
87                    "value" => "Value B",
88                    "inline" => true
89                ],
90                // Field 3
91                [
92                    "name" => "Data C",
93                    "value" => "Value C",
94                    "inline" => true
95                ]
96            ]
97        ]
98    ]
99    
100], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
101
102$headers = [ 'Content-Type: application/json; charset=utf-8' ];
103$POST = [ 'username' => 'Testing BOT', 'content' => 'Testing message' ];
104
105$ch = curl_init();
106curl_setopt($ch, CURLOPT_URL, $url);
107curl_setopt($ch, CURLOPT_POST, true);
108curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
109curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
110curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
111curl_setopt($ch, CURLOPT_POSTFIELDS, $hookObject);
112$response   = curl_exec($ch);
Loretta
14 Nov 2018
1function postToDiscord()
2{
3    $data = array("content" => "Your Content", "username" => "Webhooks");
4    $curl = curl_init("https://discordapp.com/api/webhooks/YOUR-WEBHOOK-URL-HERE");
5    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
6    curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
7    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
8    return curl_exec($curl);
9}
queries leading to this page
php discord webhook setup example workingdiscord webhook php send messagediscord embed win website with phpwebhook php script discordpost to discord webhook phpphp post to discord webhookwebhook send discord form phpcreate webhook discord phpdiscord webhook php examplediscord embed in website with phpphp discord webhook sendsend discord webhook phphow to use discord webhooks with phpphp discord webhook senderphp discord webhookwebhook discord with phpphp discor wbhookip logger php discord webhookphp to webhook discorddiscord webhook send phptelegram bot webhook nodejsdiscord embed link php php send webhook discorddiscord php webhookhow to use discord post phpphp discord embedphp discord post apiphp webhook discordphp send discord webhookphp disdord webhookphp working code discord webhookdiscord webhooks in phpphp send when user log in discord webhookphp discord webhook modulephp send webhooksend webhook message via phpdiscord hook to php apidisocrd embed in phpphp post to discord webhook imagephp discord send messagephp discord webhook with buttonsphp send when user logged in discord webhooksetup php webhook server for discorddiscord webhooks phpdiscord send webhool phpwebhooks php discord 24php discord webhook send messagediscord api webhook php examplesend discord webhook via phpwebhook discord phpphp form webhook discorddiscord webhook php formdiscord webhook with phpdiscord webhooks with phpdocumentation discord webhook phpphp discord webhook docsphp send message to discord webhookphp discord embed link how to send data to webhook php discorcdphp webhook discord examplehow to send fire discord webhooks with phpdiscord webook php examplediscord webhook example phpphp discor webhookdiscord webhook phpsend webhook phpwebhook discoird phpdiscord webhook using phpphp discord webhook file 09php discord webhook that worksphp discord webhook